From 996e40c27ee6120b9017c8d003a7d748deb15610 Mon Sep 17 00:00:00 2001 From: Guillermo Mazzola Date: Fri, 12 Jul 2024 18:02:04 +0200 Subject: [PATCH] Updated setup --- .github/workflows/ci.yaml | 32 ++++++++++++++++---------------- Dockerfile | 16 ++++++++++------ 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6c117b1..967e7f0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,14 +13,12 @@ jobs: outputs: versions: ${{ steps.fetch.outputs.versions }} steps: - - id: fetch - name: Fetch Kotlin versions + - name: Fetch Kotlin versions + id: fetch env: GH_TOKEN: ${{ github.token }} run: | - VERSIONS=$(gh --repo JetBrains/kotlin release list --exclude-drafts --exclude-pre-releases --json tagName --jq '[.[].tagName]') - - echo "versions=$VERSIONS" >> "$GITHUB_OUTPUT" + echo "versions=$(gh --repo JetBrains/kotlin release list --exclude-drafts --exclude-pre-releases --json tagName,isLatest --jq '[.[] | select(.isLatest) | .tagName | sub("^v"; "")]')" >> "$GITHUB_OUTPUT" build: runs-on: ubuntu-latest @@ -29,23 +27,20 @@ jobs: strategy: fail-fast: false matrix: - bases: - - eclipse-temurin:8 - - eclipse-temurin:8-alpine - - eclipse-temurin:11 - - eclipse-temurin:11-alpine - - eclipse-temurin:17 - - eclipse-temurin:17-alpine - - eclipse-temurin:21 - - eclipse-temurin:21-alpine + kotlin: ${{ fromJSON(needs.fetch-versions.outputs.versions) }} + java-version: + - 21 + java-vendor: + - eclipse-temurin + distribution: + - alpine + - ubuntu platform: - - linux/i386 - linux/amd64 - linux/arm/v5 - linux/arm/v6 - linux/arm/v7 - linux/arm64 - versions: ${{ fromJSON(needs.fetch-versions.outputs.versions) }} steps: - name: Prepare run: | @@ -70,6 +65,11 @@ jobs: uses: docker/build-push-action@v6 with: platforms: ${{ matrix.platform }} + build-args: | + KOTLIN_VERSION=${{ matrix.kotlin }} + JAVA_VERSION=${{ matrix.java-version }} + JAVA_VENDOR=${{ matrix.java-vendor }} + DISTRIBUTION=${{ matrix.distribution }} labels: ${{ steps.meta.outputs.labels }} outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - name: Export digest diff --git a/Dockerfile b/Dockerfile index b00ed78..1e52825 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,24 @@ -ARG BASE=eclipse-temurin:21-alpine +ARG DISTRIBUTION=ubuntu +ARG JAVA_VENDOR=eclipse-temurin +ARG JAVA_VERSION=21 -FROM $BASE +FROM eclipse-temurin:${JAVA_VERSION} as ubuntu +RUN apt-get update && \ + apt-get install -y curl bash unzip -ARG KOTLIN_VERSION=2.0.0 - -# Installs required dependencies +FROM eclipse-temurin:${JAVA_VERSION}-alpine as alpine RUN apk add curl bash unzip +FROM $DISTRIBUTION AS final + # Installs Kotlin +ARG KOTLIN_VERSION=2.0.0 RUN curl -Lf "https://github.com/JetBrains/kotlin/releases/download/v$KOTLIN_VERSION/kotlin-compiler-$KOTLIN_VERSION.zip" -o kotlin.zip && \ unzip -d /usr/local/ kotlin.zip && \ rm kotlin.zip && \ chmod -R +x /usr/local/kotlinc/bin/ && \ ln -s /usr/local/kotlinc/bin/kotlin /bin/kotlin && \ ln -s /usr/local/kotlinc/bin/kotlinc /bin/kotlinc - ENV PATH=$PATH:/usr/local/kotlinc/bin/ ENTRYPOINT ["/bin/kotlin"]