-
-
Notifications
You must be signed in to change notification settings - Fork 57
100 lines (96 loc) · 2.82 KB
/
build.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: build
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'master'
tags:
- '*'
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
env:
DOCKERHUB_SLUG: anonaddy/anonaddy
IMAGE_BUILD_TIMEOUT: "3600"
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.DOCKERHUB_SLUG }}
tags: |
type=match,pattern=(.*)-r,group=1
type=ref,event=pr
type=edge
labels: |
org.opencontainers.image.title=addy.io
org.opencontainers.image.description=Anonymous Email Forwarding
org.opencontainers.image.vendor=CrazyMax
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Build
run: |
docker buildx bake image-all -f ./docker-bake.hcl -f ${{ steps.meta.outputs.bake-file }} &
bpid=$!
sleepinter=10
iter=$(( ${{ env.IMAGE_BUILD_TIMEOUT }} / $sleepinter ))
for ((i = 0; i < iter; i++)); do
if ! kill -0 $bpid 2>/dev/null; then
exit 0
fi
sleep $sleepinter
done
echo "::error::Build timed out after ${IMAGE_BUILD_TIMEOUT} seconds"
set -x
docker exec buildx_buildkit_${{ steps.buildx.outputs.name }}0 ps aux
docker kill --signal=SIGQUIT buildx_buildkit_${{ steps.buildx.outputs.name }}0
kill -15 $bpid
wait $bpid
exit 1
# -
# name: Build
# uses: docker/bake-action@v4
# with:
# files: |
# ./docker-bake.hcl
# ${{ steps.meta.outputs.bake-file }}
# targets: image-all
# push: ${{ github.event_name != 'pull_request' }}
-
name: Check manifest
if: github.event_name != 'pull_request'
run: |
docker buildx imagetools inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
-
name: Inspect
if: github.event_name != 'pull_request'
run: |
docker pull ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}
docker image inspect ${{ env.DOCKERHUB_SLUG }}:${{ steps.meta.outputs.version }}