This repository has been archived by the owner on Dec 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
74 lines (72 loc) · 2.48 KB
/
docker-ci.yaml
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
name: Docker CI
on:
push:
branches-ignore: ["main"]
tags-ignore: ["**"]
jobs:
ci:
name: Build Docker image
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2.3.4
- name: Setup QEMU
uses: docker/setup-qemu-action@v1.1.0
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v1.3.0
with:
install: true
# Multi-arch builds run in parallel and are thus much faster than a set
# of single-arch builds. Subsequent builds leverage the same build-cache,
# so nothing gets build twice...
- name: Build image (multi-arch)
run: |
tag="${GITHUB_SHA:0:7}"
echo docker_tag="$tag" >> $GITHUB_ENV
docker build \
--tag thijsputman/tc66c-mqtt:"$tag" \
--platform linux/arm64/v8,linux/arm/v7,linux/amd64 \
.
# Build and upload a separate Docker image for each architecture (to
# facilitate testing – the images are not available anywhere else).
# Separating the artifacts is out of convenience (otherwise one would
# need to download a single big artifact containing all images).
- name: Build image (ARM64)
run: |
docker build \
--tag thijsputman/tc66c-mqtt:"${{ env.docker_tag }}" \
--output type=docker,dest=/tmp/buildx-arm64.tar \
--platform linux/arm64/v8 \
.
- name: Upload artifact (ARM64)
uses: actions/upload-artifact@v2
with:
name: buildx-arm64
path: /tmp/buildx-arm64.tar
retention-days: 30
- name: Build image (ARMv7)
run: |
docker build \
--tag thijsputman/tc66c-mqtt:"${{ env.docker_tag }}" \
--output type=docker,dest=/tmp/buildx-armv7.tar \
--platform linux/arm/v7 \
.
- name: Upload artifact (ARMv7)
uses: actions/upload-artifact@v2
with:
name: buildx-armv7
path: /tmp/buildx-armv7.tar
retention-days: 30
- name: Build image (AMD64)
run: |
docker build \
--tag thijsputman/tc66c-mqtt:"${{ env.docker_tag }}" \
--output type=docker,dest=/tmp/buildx-amd64.tar \
--platform linux/amd64 \
.
- name: Upload artifact (AMD64)
uses: actions/upload-artifact@v2
with:
name: buildx-amd64
path: /tmp/buildx-amd64.tar
retention-days: 30