diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 60197b1..3d7c949 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,14 +12,36 @@ jobs: steps: - name: Check out the repo uses: actions/checkout@v2 - - name: Push to GitHub Packages - uses: docker/build-push-action@v1 + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 with: + images: | + ghcr.io/wbrawner/twigs-server + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - repository: ${{ github.repository }}/${{ github.event.repository.name }} - registry: docker.pkg.github.com - tag_with_ref: true + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - name: Deploy uses: appleboy/ssh-action@master with: diff --git a/Dockerfile b/Dockerfile index 8113000..0e555d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM openjdk:14-jdk as builder +FROM openjdk:17-jdk as builder MAINTAINER William Brawner RUN groupadd --system --gid 1000 gradle \ @@ -8,10 +8,10 @@ COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src RUN /home/gradle/src/gradlew --console=plain --no-daemon shadowJar -FROM adoptopenjdk:openj9 +FROM openjdk:17-slim EXPOSE 8080 RUN groupadd --system --gid 1000 twigs \ && useradd --system --gid twigs --uid 1000 --create-home twigs COPY --from=builder --chown=twigs:twigs /home/gradle/src/app/build/libs/twigs.jar twigs.jar USER twigs -CMD /opt/java/openjdk/bin/java $JVM_ARGS -jar /twigs.jar +CMD /usr/local/openjdk-17/bin/java $JVM_ARGS -jar /twigs.jar