Skip to content

Fix images (#6)

Fix images (#6) #30

Workflow file for this run

name: Docker Build & Publish
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
meta:
name: Prepare metadata
runs-on: ubuntu-24.04
outputs:
datetime: ${{ steps.datetime.outputs.datetime }}
steps:
- name: Get current date and time
id: datetime
run: echo "datetime=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
image-build:
name: Build and Push (${{ matrix.arch }})
needs: meta
strategy:
matrix:
include:
- arch: amd64
- arch: arm64
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on || 'ubuntu-24.04' }}
permissions:
contents: read
actions: write
packages: write
steps:
- name: Check out repository code πŸ›ŽοΈ
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx πŸš€
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry 🚒
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ needs.meta.outputs.datetime }}
type=raw,value=latest
type=sha
type=ref,event=branch
type=ref,event=tag
flavor: |
suffix=-${{ matrix.arch }}
- name: Build and push πŸ—οΈ
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/${{ matrix.arch }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.arch }}
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
build-args: |
NEXT_PUBLIC_APP_URL=${{ secrets.NEXT_PUBLIC_APP_URL }}
NEXT_PUBLIC_OPEN_SOURCE_URL=${{ secrets.NEXT_PUBLIC_OPEN_SOURCE_URL }}
NEXT_PUBLIC_DEFAULT_LOCALE=${{ secrets.NEXT_PUBLIC_DEFAULT_LOCALE }}
merge:
name: Create multi-arch manifest
needs: [meta, image-build]
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Set up Docker Buildx πŸš€
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry 🚒
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ needs.meta.outputs.datetime }}
type=sha
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=true
- name: Create manifest list
run: |
tags="${{ steps.meta.outputs.tags }}"
for tag in $tags; do
docker buildx imagetools create -t "$tag" "${tag}-amd64" "${tag}-arm64"
done
docker buildx imagetools inspect "$tag"