-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (84 loc) · 3.38 KB
/
builder.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
name: builder-ci
on:
push:
tags:
- 'v*'
env:
DOCKERHUB_SLUG: xxacielxx/rutorrent
GHCR_SLUG: ghcr.io/xxacielxx/rutorrent
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up environments
run: |
echo "version=org.opencontainers.image.version=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "revision=org.opencontainers.image.revision=${GITHUB_SHA}" >> $GITHUB_ENV
echo "created=org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build Image & Push amd64
run: |
docker buildx build \
--provenance=false \
--label ${{ env.version }} \
--label ${{ env.revision }} \
--label ${{ env.created }} \
-t "${{ env.DOCKERHUB_SLUG }}:amd64-latest" \
-t "${{ env.GHCR_SLUG }}:amd64-latest" \
--platform linux/amd64 -f ./Dockerfile --push .
- name: Build Image & Push arm32v7
run: |
docker buildx build \
--provenance=false \
--label ${{ env.version }} \
--label ${{ env.revision }} \
--label ${{ env.created }} \
-t "${{ env.DOCKERHUB_SLUG }}:arm32v7-latest" \
-t "${{ env.GHCR_SLUG }}:arm32v7-latest" \
--platform linux/arm/v7 -f ./Dockerfile --push .
- name: Build Image & Push arm64v8
run: |
docker buildx build \
--provenance=false \
--label ${{ env.version }} \
--label ${{ env.revision }} \
--label ${{ env.created }} \
-t "${{ env.DOCKERHUB_SLUG }}:arm64v8-latest" \
-t "${{ env.GHCR_SLUG }}:arm64v8-latest" \
--platform linux/arm64/v8 -f ./Dockerfile --push .
- name: Create manifest Docker Hub
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
[[ -f Dockerfile ]] && AMD64=${{ env.DOCKERHUB_SLUG }}:amd64-latest
[[ -f Dockerfile ]] && ARMV7=${{ env.DOCKERHUB_SLUG }}:arm32v7-latest
[[ -f Dockerfile ]] && ARM64=${{ env.DOCKERHUB_SLUG }}:arm64v8-latest
echo "*** Push Latest Tag Image ***"
docker manifest create ${{ env.DOCKERHUB_SLUG }}:latest ${AMD64} ${ARMV7} ${ARM64}
docker manifest push ${{ env.DOCKERHUB_SLUG }}:latest
- name: Create manifest GitHub
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
[[ -f Dockerfile ]] && GHCR_AMD64=${{ env.GHCR_SLUG }}:amd64-latest
[[ -f Dockerfile ]] && GHCR_ARMV7=${{ env.GHCR_SLUG }}:arm32v7-latest
[[ -f Dockerfile ]] && GHCR_ARM64=${{ env.GHCR_SLUG }}:arm64v8-latest
echo "*** Push GitHub Latest Tag Image ***"
docker manifest create ${{ env.GHCR_SLUG }}:latest ${GHCR_AMD64} ${GHCR_ARMV7} ${GHCR_ARM64}
docker manifest push ${{ env.GHCR_SLUG }}:latest