Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Scala SBT dockerfile - runs SBT to build, and then copies on the jar to the alpine java image
# This uses the Docker builder pattern.
# The first container runs SBT to stage our application.
# todo - use a Docker image that has already downloaded SBT
FROM hseeberger/scala-sbt AS builder
COPY src src
COPY project project
COPY build.sbt build.sbt
RUN sbt stage
# The second takes the generated jars and scripts from the first, and places them in a minimal JRE container.
# Therefore, we don't have to run a container with SBT inside it. It is much smaller.
FROM openjdk:jre-alpine
COPY --from=builder --chown=daemon:daemon /app/target/universal/stage /opt
USER daemon
ENTRYPOINT ["/opt/bin/allez"]
CMD []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment