From 5ef5de36be05e89c945c32cadc3f92195cbcd13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20=C5=A0est=C3=A1k?= Date: Fri, 22 Sep 2023 08:47:29 +0200 Subject: [PATCH] [CI] Test with recent Java/NPM versions --- .github/workflows/build.yml | 16 +++++++++++++++- Dockerfile | 20 ++++++++++++++++---- dockerenv-github.sh | 4 +++- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2e32f56..ea8d68b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,4 +23,18 @@ jobs: uses: actions/upload-artifact@v2 with: name: site - path: pack.zip \ No newline at end of file + path: pack.zip + + test-bleeding-edge-java-and-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: build image + run: docker build . --target bleeding-edge + - name: build website + run: env DOCKER_TAG=bleeding-edge ./dockerenv-github.sh ./pack.sh + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: site + path: pack-for-verification.zip diff --git a/Dockerfile b/Dockerfile index fb58410..575e069 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,5 @@ # Adopted from mozilla/sbt -# This Dockerfile has one required ARG to determine which base image -# to use for the JDK to install. - # JDK 8 is the LTS with the longest support at the time of writing. ARG OPENJDK_TAG=8 @@ -12,7 +9,7 @@ COPY project/build.properties / RUN sed -n -e 's/^sbt\.version=//p' /build.properties > /version # Second stage creates final image with the right SBT version -FROM amazoncorretto:${OPENJDK_TAG} +FROM amazoncorretto:${OPENJDK_TAG} AS conservative RUN yum install -y rsync lftp zip unzip which ARG NODE_VERSION=16 RUN yum install https://rpm.nodesource.com/pub_${NODE_VERSION}.x/nodistro/repo/nodesource-release-nodistro-1.noarch.rpm -y @@ -25,3 +22,18 @@ RUN \ rm sbt-$(cat /sbt-version).rpm && \ mkdir /project WORKDIR /project + +# This stage can be used for testing whether the build is compatible with fresh versions of JDK and NodeJS/NPM +FROM fedora:latest AS bleeding-edge +RUN dnf install -y rsync lftp zip unzip which nodejs npm java-latest-openjdk-devel +COPY --from=sbt-version /version /sbt-version +RUN \ + curl -L -o sbt-$(cat /sbt-version).rpm https://scala.jfrog.io/ui/api/v1/download\?repoKey=rpm\&path=%252Fsbt-$(cat /sbt-version).rpm && \ + echo SBT launcher downloaded && \ + rpm -i sbt-$(cat /sbt-version).rpm && \ + rm sbt-$(cat /sbt-version).rpm && \ + mkdir /project +WORKDIR /project + + +FROM conservative AS default diff --git a/dockerenv-github.sh b/dockerenv-github.sh index 2a3a66f..b5be403 100755 --- a/dockerenv-github.sh +++ b/dockerenv-github.sh @@ -4,6 +4,8 @@ set -u set -e set -o pipefail +TAG=${DOCKER_TAG:-conservative} + exec docker run \ -v "$HOME"/.ivycache:/root/.ivy2 \ -v "$HOME"/.sbtcache:/root/.sbt \ @@ -12,5 +14,5 @@ exec docker run \ -v "$HOME"/.ssh/zbdb-id_rsa.pub:/root/.ssh/id_rsa.pub:ro \ -v "$(pwd)":/project \ -p 9000:9000 \ - "$(docker build -q .)" \ + "$(docker build -q . --target $TAG)" \ "$@"