This repository has been archived by the owner on Dec 3, 2024. It is now read-only.
Add frontend #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Images | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- arch: amd64 | |
qemu_arch: x86_64 | |
tag_suffix: '' | |
latest_tag: latest | |
graalvm_version: '21.3.0' | |
java_version: 'java11' | |
- arch: arm64 | |
qemu_arch: aarch64 | |
tag_suffix: '-arm64' | |
latest_tag: latest-arm64 | |
graalvm_version: '21.3.0' | |
java_version: 'java11' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '17' | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build native image with Gradle | |
run: ./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: src/main/docker/Dockerfile.native | |
platforms: linux/${{ matrix.arch }} | |
tags: | | |
ghcr.io/${{ github.repository_owner }}/webring-api:${{ github.sha }}${{ matrix.tag_suffix }} | |
ghcr.io/${{ github.repository_owner }}/webring-api:${{ matrix.latest_tag }} | |
push: true | |
- name: Logout of GitHub Container Registry | |
run: docker logout ghcr.io | |
- name: Publish package | |
uses: gradle/gradle-build-action@v2 | |
# Only run on amd64 | |
if: matrix.arch == 'amd64' | |
with: | |
arguments: publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |