Skip to content

Build and Push Frontend/Backend Images (Single-Arch Tags) #42

Build and Push Frontend/Backend Images (Single-Arch Tags)

Build and Push Frontend/Backend Images (Single-Arch Tags) #42

Workflow file for this run

name: Build and Push Frontend/Backend Images (Single-Arch Tags)
on:
push:
branches: ["main"]
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
OWNER_LC: joshicodes
IMAGE_BASE: ghcr.io/joshicodes/arenauth
jobs:
# BACKEND ARM64 (native)
backend-arm64:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Ensure mvnw executable
working-directory: ./backend
run: chmod +x mvnw
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build backend native binary (arm64)
working-directory: ./backend
run: ./mvnw -B clean package -Dnative -Dquarkus.native.container-build=true -DskipTests
- name: Build backend image (arm64)
run: docker build -f backend/src/main/docker/Dockerfile.native -t ${{ env.IMAGE_BASE }}/backend:arm64 ./backend
- name: Push backend image (arm64)
run: docker push ${{ env.IMAGE_BASE }}/backend:arm64
# BACKEND AMD64 (native)
backend-amd64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Ensure mvnw executable
working-directory: ./backend
run: chmod +x mvnw
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build backend native binary (amd64)
working-directory: ./backend
run: ./mvnw -B clean package -Dnative -Dquarkus.native.container-build=true -DskipTests
- name: Build backend image (amd64)
run: docker build -f backend/src/main/docker/Dockerfile.native -t ${{ env.IMAGE_BASE }}/backend:amd64 ./backend
- name: Push backend image (amd64)
run: docker push ${{ env.IMAGE_BASE }}/backend:amd64
# FRONTEND ARM64
frontend-arm64:
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build frontend image (arm64)
run: docker build -f frontend/Dockerfile -t ${{ env.IMAGE_BASE }}/frontend:arm64 ./frontend
- name: Push frontend image (arm64)
run: docker push ${{ env.IMAGE_BASE }}/frontend:arm64
# FRONTEND AMD64
frontend-amd64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build frontend image (amd64)
run: docker build -f frontend/Dockerfile -t ${{ env.IMAGE_BASE }}/frontend:amd64 ./frontend
- name: Push frontend image (amd64)
run: docker push ${{ env.IMAGE_BASE }}/frontend:amd64