Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont use mill's assembly output #6

Merged
merged 1 commit into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.0.5 - [Unreleased]
## 0.0.7 - [Unreleased]

## [0.0.6] - 2018-12-05

### Changed
- Dont use mill's `assembly` (as sometimes it generated an executable) instead make `dockerJar` create its own fat jat. Fixes #1

## [0.0.5] - 2018-11-20

Expand All @@ -17,5 +22,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Scala and mill versions are managed from `.tool-versions` file.
The VERSION specifies this project's version number.

[Unreleased]: https://github.com/vic/mill-docker/compare/0.0.5...HEAD
[Unreleased]: https://github.com/vic/mill-docker/compare/0.0.6...HEAD
[0.0.6]: https://github.com/vic/mill-docker/compare/0.0.5...0.0.6
[0.0.5]: https://github.com/vic/mill-docker/compare/0.0.4...0.0.5
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.5
0.0.6
16 changes: 14 additions & 2 deletions docker/src/DockerModule.scala
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
package mill.docker

import mill._
import mill.scalalib.JavaModule
import mill.modules.Jvm.{createAssembly}

trait DockerModule extends Module {

trait DockerModule extends JavaModule {

def finalMainClass: T[String]
def assembly: T[PathRef]

def dockerTag: T[String]
def dockerJar = T[PathRef] { assembly() }
def dockerMain = T[String] { finalMainClass() }
def dockerJavaOpts = T[Seq[String]] { Seq() }
def dockerMainArgs = T[Seq[String]] { Seq() }

def dockerJar = T[PathRef] {
createAssembly(
Agg.from(localClasspath().map(_.path)),
None /* main=None, to always create a fat jar, not an executable like mill's assembly does */,
"" /* no prepend script */,
Some(upstreamAssembly().path),
assemblyRules
)
}

def dockerBaseImage: T[String] = "gcr.io/distroless/java:latest"

def dockerFile: T[String] = s"""
Expand Down
2 changes: 1 addition & 1 deletion example/build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interp.repositories() =
import mill._, scalalib._

// import mill-docker
import $ivy.`io.github.vic::mill-docker:0.0.5`, mill.docker._
import $ivy.`io.github.vic::mill-docker:0.0.6`, mill.docker._


object hello extends ScalaModule with DockerModule {
Expand Down