Repository navigation
63 lines (54 loc) · 1.77 KB
/
Copy pathbuild_docker.yml
File metadata and controls
63 lines (54 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Build Docker Image
on:
push:
tags:
- 'v*'
permissions:
contents: read
packages: write
env:
GHCR_REPO: ghcr.io/aurora-develop/aurora
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve version from tag
id: version
shell: bash
run: |
tag="${GITHUB_REF_NAME}"
version="${tag#v}"
if [ -z "${version}" ] || [ "${version}" = "${tag}" ]; then
echo "Expected a tag in the form v<version>, got: ${tag}" >&2
exit 1
fi
echo "version=${version}" >> "${GITHUB_OUTPUT}"
echo "tag=${tag}" >> "${GITHUB_OUTPUT}"
echo "sha_short=${GITHUB_SHA::12}" >> "${GITHUB_OUTPUT}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push to GHCR
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/s390x
push: true
provenance: false
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ steps.version.outputs.version }}
${{ env.GHCR_REPO }}:${{ steps.version.outputs.tag }}
${{ env.GHCR_REPO }}:${{ steps.version.outputs.sha_short }}
cache-from: type=gha,scope=${{ github.ref_name }}
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}