Working image with SBT pre-cached.
This commit is contained in:
parent
baa1ad1e7f
commit
8a2584f851
1 changed files with 20 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
FROM docker.io/library/eclipse-temurin:21-jdk-alpine
|
||||
|
||||
ARG SCALA_VERSION
|
||||
ENV SCALA_VERSION ${SCALA_VERSION:-3.4.0}
|
||||
ARG SBT_VERSION
|
||||
ENV SBT_VERSION ${SBT_VERSION:-1.9.9}
|
||||
|
||||
# git is required for checkout
|
||||
# python3 is required for pre-commit
|
||||
# node is required for Forgejo checkout
|
||||
|
@ -14,11 +19,25 @@ RUN adduser -S -h /home/builder -s /bin/bash -G builder -u 1000 builder
|
|||
USER builder
|
||||
WORKDIR /home/builder
|
||||
|
||||
# Coursier provides all Scala development requirements.
|
||||
RUN curl -fLo coursier https://github.com/coursier/launchers/raw/master/coursier
|
||||
RUN chmod +x coursier
|
||||
RUN ./coursier setup --yes --apps coursier,sbt,sbt-launcher,scalafmt,scalac
|
||||
RUN ./coursier setup --yes
|
||||
RUN rm ./coursier
|
||||
RUN mkdir -p /home/builder/.local/bin
|
||||
ENV PATH="${PATH}:/home/builder/.local/share/coursier/bin"
|
||||
ENV PATH="${PATH}:/home/builder/.local/bin"
|
||||
|
||||
# Make Git not complain.
|
||||
RUN git config --global init.defaultBranch main
|
||||
|
||||
# Warm up the SBT cache (taken from official SBT Docker image).
|
||||
RUN \
|
||||
sbt sbtVersion && \
|
||||
mkdir -p project && \
|
||||
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
|
||||
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
|
||||
echo "// force sbt compiler-bridge download" > project/Dependencies.scala && \
|
||||
echo "case object Temp" > Temp.scala && \
|
||||
sbt compile && \
|
||||
rm -r project && rm build.sbt && rm Temp.scala && rm -r target
|
||||
|
|
Loading…
Add table
Reference in a new issue