|
|
|
|
@ -15,8 +15,19 @@ env:
|
|
|
|
|
DOCKERHUB_IMAGE: mord0rek/glance-polski
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
build-and-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
build:
|
|
|
|
|
name: Build
|
|
|
|
|
runs-on: ${{ matrix.runner }}
|
|
|
|
|
strategy:
|
|
|
|
|
fail-fast: false
|
|
|
|
|
matrix:
|
|
|
|
|
include:
|
|
|
|
|
- platform: linux/amd64
|
|
|
|
|
runner: ubuntu-latest
|
|
|
|
|
arch: amd64
|
|
|
|
|
- platform: linux/arm64
|
|
|
|
|
runner: ubuntu-24.04-arm
|
|
|
|
|
arch: arm64
|
|
|
|
|
permissions:
|
|
|
|
|
contents: read
|
|
|
|
|
packages: write
|
|
|
|
|
@ -26,9 +37,6 @@ jobs:
|
|
|
|
|
- name: Checkout repository
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
|
|
@ -40,6 +48,59 @@ jobs:
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Extract metadata (tags, labels)
|
|
|
|
|
id: meta
|
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
|
with:
|
|
|
|
|
images: ${{ env.DOCKERHUB_IMAGE }}
|
|
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
|
id: build
|
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
|
with:
|
|
|
|
|
context: .
|
|
|
|
|
file: ./Dockerfile
|
|
|
|
|
platforms: ${{ matrix.platform }}
|
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
outputs: type=image,name=${{ env.DOCKERHUB_IMAGE }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
|
|
|
|
|
cache-from: type=gha,scope=build-${{ matrix.arch }}
|
|
|
|
|
cache-to: type=gha,mode=max,scope=build-${{ matrix.arch }}
|
|
|
|
|
|
|
|
|
|
- name: Export digest
|
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
|
run: |
|
|
|
|
|
mkdir -p /tmp/digests
|
|
|
|
|
digest="${{ steps.build.outputs.digest }}"
|
|
|
|
|
touch "/tmp/digests/${digest#sha256:}"
|
|
|
|
|
|
|
|
|
|
- name: Upload digest
|
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
|
with:
|
|
|
|
|
name: digests-${{ matrix.arch }}
|
|
|
|
|
path: /tmp/digests/*
|
|
|
|
|
if-no-files-found: error
|
|
|
|
|
retention-days: 1
|
|
|
|
|
|
|
|
|
|
merge:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
|
needs: build
|
|
|
|
|
permissions:
|
|
|
|
|
contents: read
|
|
|
|
|
packages: write
|
|
|
|
|
id-token: write
|
|
|
|
|
steps:
|
|
|
|
|
- name: Download digests
|
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
|
with:
|
|
|
|
|
path: /tmp/digests
|
|
|
|
|
pattern: digests-*
|
|
|
|
|
merge-multiple: true
|
|
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
|
|
- name: Docker meta
|
|
|
|
|
id: meta
|
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
|
with:
|
|
|
|
|
@ -53,14 +114,18 @@ jobs:
|
|
|
|
|
type=sha,prefix={{branch}}-
|
|
|
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
|
- name: Log in to Docker Hub
|
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
|
with:
|
|
|
|
|
context: .
|
|
|
|
|
file: ./Dockerfile
|
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
cache-from: type=gha
|
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
|
|
- name: Create manifest list and push
|
|
|
|
|
working-directory: /tmp/digests
|
|
|
|
|
run: |
|
|
|
|
|
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
|
|
|
$(printf '${{ env.DOCKERHUB_IMAGE }}@sha256:%s ' *)
|
|
|
|
|
|
|
|
|
|
- name: Inspect image
|
|
|
|
|
run: |
|
|
|
|
|
docker buildx imagetools inspect ${{ env.DOCKERHUB_IMAGE }}:${{ steps.meta.outputs.version }}
|
|
|
|
|
|