sbt-docker | Create Docker images directly from sbt | Continuous Deployment library
kandi X-RAY | sbt-docker Summary
kandi X-RAY | sbt-docker Summary
sbt-docker is an [sbt][sbt] plugin that builds and pushes [Docker][docker] images for your project.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of sbt-docker
sbt-docker Key Features
sbt-docker Examples and Code Snippets
Community Discussions
Trending Discussions on sbt-docker
QUESTION
We have a play2/scala
application which we are building with gitlab ci.
Our .gitlab-ci.yml
(at least the important part) looks as follows:
ANSWER
Answered 2017-Jan-18 at 17:20There are 4 things you can do:
- own docker image
- cache
- artifacts
- use own caching solution
The best solution will be a mix of them all.
- You can build your own docker image with all the dependencies you need, it's the fastest solution as it won't have to download everything but it will introduce another piece of the puzzle you need to take care of. You can use the in-built gitlab repository for storing it and have gitlab build it and then use it.
- You can use cache in Gitlab CI jobs so it won't have to download everything all the time. The default cache for sbt seems to be ~/.ivy2 so add
QUESTION
To speed up our development workflow we split the tests and run each part on multiple agents in parallel. However, compiling test sources seem to take most of the time for the testing steps.
To avoid this, we pre-compile the tests using sbt test:compile
and build a docker image with compiled targets.
Later, this image is used in each agent to run the tests. However, it seems to recompile the tests and application sources even though the compiled classes exists.
Is there a way to make sbt use existing compiled targets?
Update: To give more context
The question strictly relates to scala and sbt (hence the sbt tag).
Our CI process is broken down in to multiple phases. Its roughly something like this.
stage 1: Use SBT to compile Scala project into java bitecode using
sbt compile
We compile the test sources in the same test usingsbt test:compile
The targes are bundled in a docker image and pushed to the remote repository,stage 2: We use multiple agents to split and run tests in parallel. The tests run from the built docker image, so the environment is the same. However, running
sbt test
causes the project to recompile even through the compiled bitecode exists.
To make this clear, I basically want to compile on one machine and run the compiled test sources in another without re-compiling
Update
I don't think https://stackoverflow.com/a/37440714/8261 is the same problem because unlike it, I don't mount volumes or build on the host machine. Everything is compiled and run within docker but in two build stages. The file modified times and paths are retained the same because of this.
The debug output has something like this
...ANSWER
Answered 2019-Jan-08 at 12:04I think there is already an answer to this here: https://stackoverflow.com/a/37440714/8261
It looks tricky to get exactly right. Good luck!
Avoiding SBT:If the above approach is too difficult (i.e. getting sbt test
to consider that your test classes do not need re-compiling), you could instead avoid using sbt
but instead run your test suite using java
directly.
If you can get sbt
to log the java
command that it is using to run your test suite (e.g. using debug logging), then you could run that command on your test runner agents directly, which would completely preclude sbt
re-compiling things.
(You might need to write the java
command into a script file, if the classpath is too long to pass as a command-line argument in your shell. I have previously had to do that for a large project.)
This would be a much hackier approach that the one above, but might be quicker to get working.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sbt-docker
Below are some documentation on the sbt tasks and settings in the plugin. This blog post gives a good introduction to the basics of sbt-docker: [Dockerizing your Scala apps with sbt-docker][dockerizing-scala-apps]. Also, take a look at the [example projects](examples).
Use the key docker / buildOptions to set build options.
Use the key docker / dockerBuildArguments to set build arguments.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page