tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
573 stars 99 forks source link

Multistage docker #594

Closed defect closed 5 years ago

defect commented 5 years ago

This adds a multistage dockerfile based on @byxorna 's work in #562. The main difference is that this one actually has three stages. dev, build, and production. The reason for the addition of the first stage is to make it easy to set up the development environment and start hacking. By targeting that stage we can build and start the dev environment easily:

$  docker build --target dev -t collins-dev .
$  docker run -v "$(pwd)":/build/collins -it collins-dev

This will launch into activator where we then can start watching for changes and rebuild whenever a file on the local copy changes:

[collins] $ ~compile
[success] Total time: 0 s, completed Feb 1, 2019 2:30:02 AM
1. Waiting for source changes... (press enter to interrupt)
[success] Total time: 0 s, completed Feb 1, 2019 2:30:17 AM
2. Waiting for source changes... (press enter to interrupt)
[success] Total time: 0 s, completed Feb 1, 2019 2:30:25 AM
3. Waiting for source changes... (press enter to interrupt)
[info] Compiling 1 Scala source to /build/collins/target/scala-2.11/classes...
[success] Total time: 2 s, completed Feb 1, 2019 2:30:31 AM

I'm also updating the java version gating in scripts/package.sh to check for java newer than 1.8, and have it print a warning message if it is.

@tumblr/collins @byxorna