Skip to content

Commit

Permalink
Updated setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Jul 12, 2024
1 parent e17d9c9 commit 996e40c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand Down
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 996e40c

Please sign in to comment.