-
Notifications
You must be signed in to change notification settings - Fork 4
43 lines (42 loc) · 1.36 KB
/
image.yml
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
name: image
on:
pull_request:
push:
branches: [master]
jobs:
build-image:
strategy:
matrix:
arch: [amd64]
runs-on: ubuntu-latest
env:
IMG_CACHE: ghcr.io/getsentry/chartcuterie:${{ matrix.arch }}-latest
IMG_VERSIONED: ghcr.io/getsentry/chartcuterie:${{ matrix.arch }}-${{ github.sha }}
steps:
- uses: actions/checkout@v3
- run: docker run --rm --privileged tonistiigi/binfmt --install arm64
if: matrix.arch == 'arm64'
- name: build
run: |
set -euxo pipefail
args=()
if docker pull -q "$IMG_CACHE"; then
args+=(--cache-from "$IMG_CACHE")
fi
docker buildx build \
"${args[@]}" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--platform linux/${{ matrix.arch }} \
--tag "$IMG_VERSIONED" \
.
docker tag "$IMG_VERSIONED" "$IMG_CACHE"
- name: push
if: github.event_name != 'pull_request'
run: |
set -euxo pipefail
docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
docker push "$IMG_VERSIONED"
docker push "$IMG_CACHE"
# for now arm64 is too slow so just retag this as latest
docker tag "$IMG_VERSIONED" ghcr.io/getsentry/chartcuterie:latest
docker push ghcr.io/getsentry/chartcuterie:latest