Build image including JDK 1.8, and a bootstrapped copy of sbt. Useful for doing CI integration with Scala projects, or just if you can't be bothered to set up sbt.
Simply fire it up and run sbt commands on it. Commands run as the user "ci", so an example for an interactive session could be:
docker run --rm -it --mount "type=bind,src=/path/to/my/sourcecode,dst=/home/ci/myproject" -w /home/ci/myproject andyg42/alpine-scala-build sbt
As it's on Alpine there is not much else present on the image.
I originally created this image for use in CircleCI 2.0. An example CircleCI config yaml is:
scala_build_test:
<<: *defaults
environment:
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
SBT_OPTS: -Dfile.encoding=UTF8 -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:+UseCompressedOops
docker:
- image: andyg42/alpine-scala-build:4
steps:
- checkout
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS
# Restore the dependency cache
- restore_cache:
keys:
# This branch if available
- v3-dep-{{ .Branch }}-scala-
# Default branch if not
- v3-dep-master-
# Any branch if there are none on the default branch - this should be unnecessary if you have your default branch configured correctly
- v3-dep-
- run: echo exit | sbt test:compile
# Save dependency cache
- save_cache:
key: v3-dep-{{ .Branch }}-scala-{{ epoch }}
paths:
- ~/.m2
- ~/.ivy2
- ~/.bundle
- ~/.go_workspace
- ~/.gradle
- ~/.cache/bower
# These cache paths were specified in the 1.0 config
- run: echo exit | sbt test
- store_test_results:
path: /tmp/circleci-test-results
# Save artifacts
- store_artifacts:
path: /tmp/circleci-artifacts
- store_artifacts:
path: /tmp/circleci-test-results
- run: echo exit | sbt riffRaffUpload
This uses a custom sbt step to talk to our in-house deployment system RiffRaff, but you could substitute any other sbt step in there like rpm:packageBin.
docker pull andyg42/alpine-scala-build:7