This image is based on on alpine linux with Java 8 and includes SBT 1.3.5. You can optionally install Scala and make it available directly.
This is image is available here: brunojppb/scala-sbt:1.3.5
The Dockerfile.yml
:
FROM openjdk:8-alpine
LABEL maintainer="[email protected]"
RUN apk update
RUN apk add postgresql-client
# Optional: Install Scala
# ENV SCALA_VERSION=2.12.8 \
# SCALA_HOME=/usr/share/scala
# NOTE: bash is used by scala/scalac scripts, and it cannot be easily replaced with ash.
# Optional Scala lang installed directly
# RUN apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \
# apk add --no-cache bash curl jq && \
# cd "/tmp" && \
# wget --no-verbose "https://downloads.typesafe.com/scala/${SCALA_VERSION}/scala-${SCALA_VERSION}.tgz" && \
# tar xzf "scala-${SCALA_VERSION}.tgz" && \
# mkdir "${SCALA_HOME}" && \
# rm "/tmp/scala-${SCALA_VERSION}/bin/"*.bat && \
# mv "/tmp/scala-${SCALA_VERSION}/bin" "/tmp/scala-${SCALA_VERSION}/lib" "${SCALA_HOME}" && \
# ln -s "${SCALA_HOME}/bin/"* "/usr/bin/" && \
# apk del .build-dependencies && \
# rm -rf "/tmp/"*
RUN apk add --no-cache --virtual=.build-dependencies wget ca-certificates && apk add --no-cache bash curl jq
# Install SBT
RUN export PATH="/usr/local/sbt/bin:$PATH" \
&& apk update \
&& apk add ca-certificates wget tar && mkdir -p "/usr/local/sbt" \
&& wget -qO - --no-check-certificate "https://piccolo.link/sbt-1.3.5.tgz" | tar xz -C /usr/local/sbt --strip-components=1 \
&& sbt sbtVersion
# add sbt to path
ENV PATH "/usr/local/sbt/bin:$PATH"
# now on your production image
# you can run `sbt stage` or `sbt dist` to generate your build