Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: re-enable basic test on alpine #317

Merged
merged 4 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,13 @@ jobs:
SCALA_VERSION=${{ matrix.scalaVersion }}
load: true
- name: Test docker image as root (default)
if: ${{ !startsWith(matrix.scalaVersion, '2.12') && !contains(matrix.baseImageTag, 'alpine') }}
if: ${{ !startsWith(matrix.scalaVersion, '2.12') }}
# scala --version does not work on < 2.13
# sbt --script-version does not work on alpine https://github.com/sbt/sbt/issues/7942
run: |
docker run "${{ steps.create_docker_tag.outputs.TAG }}" /bin/bash -c "scala --version && sbt --script-version"
- name: Test docker image scala as sbtuser
if: ${{ !startsWith(matrix.scalaVersion, '2.12') && !contains(matrix.baseImageTag, 'alpine') }}
if: ${{ !startsWith(matrix.scalaVersion, '2.12') }}
# scala --version does not work on < 2.13
# sbt --script-version does not work on alpine https://github.com/sbt/sbt/issues/7942
run: |
docker run -u sbtuser -w /home/sbtuser "${{ steps.create_docker_tag.outputs.TAG }}" /bin/bash -c "scala --version && sbt --script-version"
- name: Log in to DockerHub
Expand Down
2 changes: 1 addition & 1 deletion amazoncorretto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ WORKDIR /home/sbtuser

# Prepare sbt (warm cache)
RUN \
sbt sbtVersion && \
sbt --script-version && \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
Expand Down
2 changes: 1 addition & 1 deletion eclipse-temurin/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ WORKDIR /home/sbtuser

# Prepare sbt (warm cache)
RUN \
sbt sbtVersion && \
sbt --script-version && \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
Expand Down
28 changes: 15 additions & 13 deletions eclipse-temurin/alpine.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# Use a multi-stage build to reduce the size of the final image
# The builder will install curl, bc and ca-certificates which are needed to install sbt and scala.
# The final image will only contain bash, git, rpm, sbt and scala.

ARG BASE_IMAGE_TAG
FROM eclipse-temurin:${BASE_IMAGE_TAG:-21.0.2_13-jdk-alpine} AS builder

ARG SCALA_VERSION=3.4.0
ARG SBT_VERSION=1.9.9
ARG SBT_VERSION=1.10.7
ARG USER_ID=1001
ARG GROUP_ID=1001
ENV SCALA_HOME=/usr/share/scala

# Install dependencies
RUN apk add --no-cache --virtual=.build-dependencies wget ca-certificates bash curl bc
RUN apk add wget ca-certificates bash curl bc

# Update certificates, still needed?
RUN update-ca-certificates

# Install sbt
RUN \
curl -fsL --show-error https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz | tar xfz - -C /usr/local && \
ln -s /usr/local/sbt/bin/* /usr/local/bin/ && \
sbt --script-version

# Install scala
RUN \
Expand All @@ -21,24 +33,13 @@ RUN \
curl -fsL --show-error $URL | tar xfz - -C /usr/share && \
mv $SCALA_DIR $SCALA_HOME && \
ln -s "$SCALA_HOME/bin/"* "/usr/bin/" && \
update-ca-certificates && \
scala -version && \
case $SCALA_VERSION in \
2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \
*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \
esac && \
scala -nocompdaemon test.scala && rm test.scala

# Install sbt
RUN \
curl -fsL --show-error https://github.com/sbt/sbt/releases/download/v$SBT_VERSION/sbt-$SBT_VERSION.tgz | tar xfz - -C /usr/local && \
$(mv /usr/local/sbt-launcher-packaging-$SBT_VERSION /usr/local/sbt || true) && \
ln -s /usr/local/sbt/bin/* /usr/local/bin/ && \
sbt -Dsbt.rootdir=true -batch sbtVersion && \
apk del .build-dependencies && \
rm -rf "/tmp/"* && \
rm -rf /var/cache/apk/*

# Start a new stage for the final image
FROM eclipse-temurin:${BASE_IMAGE_TAG:-21.0.2_13-jdk-alpine}

Expand All @@ -64,6 +65,7 @@ ENV PATH="/usr/share/scala/bin:${PATH}"

# Prepare sbt (warm cache)
RUN \
sbt --script-version && \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
Expand Down
2 changes: 1 addition & 1 deletion graalvm-ce/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ WORKDIR /home/sbtuser

# Prepare sbt (warm cache)
RUN \
sbt sbtVersion && \
sbt --script-version && \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
Expand Down
2 changes: 1 addition & 1 deletion graalvm-community/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ WORKDIR /home/sbtuser

# Prepare sbt (warm cache)
RUN \
sbt sbtVersion && \
sbt --script-version && \
mkdir -p project && \
echo "scalaVersion := \"${SCALA_VERSION}\"" > build.sbt && \
echo "sbt.version=${SBT_VERSION}" > project/build.properties && \
Expand Down
Loading