-
Notifications
You must be signed in to change notification settings - Fork 2
115 lines (100 loc) · 4.14 KB
/
build_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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
on:
repository_dispatch:
types: [build-artifacts]
name: Build Artifacts
jobs:
build_image_and_publish:
strategy:
fail-fast: true
matrix:
include:
- label: x86_64
suffix: amd64
platform: linux/amd64
dockerfile: Dockerfile
- label: ARM64
suffix: arm64
platform: linux/arm64
dockerfile: Dockerfile.arm64
- label: ARMv7
suffix: armv7
platform: linux/arm/v7
dockerfile: Dockerfile.armv7
name: "${{ matrix.label }}: Build and Publish Docker Image"
if: github.event.client_payload.tag != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 'refs/tags/${{ github.event.client_payload.tag }}'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: ${{ matrix.platform }}
push: true
file: ${{ matrix.dockerfile }}
tags: |
oguzbilgener/noxious:latest-${{ matrix.suffix }}
oguzbilgener/noxious:${{ github.event.client_payload.version }}-${{ matrix.suffix }}
ghcr.io/oguzbilgener/noxious:latest-${{ matrix.suffix }}
ghcr.io/oguzbilgener/noxious:${{ github.event.client_payload.version }}-${{ matrix.suffix }}
publish_multi_arch_image:
name: Publish Multi-Arch Image
if: github.event.client_payload.tag != ''
runs-on: ubuntu-latest
needs:
- build_image_and_publish
steps:
- uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install manifest-tool
run: |
curl -fSL -o ./manifest-tool https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64
curl -fSL -o ./manifest-tool.asc https://github.com/estesp/manifest-tool/releases/download/v1.0.2/manifest-tool-linux-amd64.asc
export GNUPGHOME="$(mktemp -d)"
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys 27F3EA268A97867EAF0BD05C0F386284C03A1162
gpg --batch --verify manifest-tool.asc manifest-tool
chmod +x ./manifest-tool
rm manifest-tool.asc
- name: Push Multi-Arch Manifest
run: |
./manifest-tool push from-args \
--platforms linux/amd64,linux/arm64,linux/arm/v7 \
--template oguzbilgener/noxious:${{ github.event.client_payload.version }}-ARCHVARIANT \
--target oguzbilgener/noxious:${{ github.event.client_payload.version }}
./manifest-tool push from-args \
--platforms linux/amd64,linux/arm64,linux/arm/v7 \
--template ghcr.io/oguzbilgener/noxious:${{ github.event.client_payload.version }}-ARCHVARIANT \
--target ghcr.io/oguzbilgener/noxious:${{ github.event.client_payload.version }}
./manifest-tool push from-args \
--platforms linux/amd64,linux/arm64,linux/arm/v7 \
--template oguzbilgener/noxious:latest-ARCHVARIANT \
--target oguzbilgener/noxious:latest
./manifest-tool push from-args \
--platforms linux/amd64,linux/arm64,linux/arm/v7 \
--template ghcr.io/oguzbilgener/noxious:latest-ARCHVARIANT \
--target ghcr.io/oguzbilgener/noxious:latest