-
Notifications
You must be signed in to change notification settings - Fork 604
78 lines (64 loc) · 3.18 KB
/
cpp-docker.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
name: C/C++ CI docker
on: [push]
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
dockerfile: Dockerfile.windows
arch: windows
- os: ubuntu-latest
dockerfile: Dockerfile.arm64
arch: arm64
image: arm64v8/ubuntu
- os: ubuntu-latest
dockerfile: Dockerfile.rpi
arch: armv6l
crosscompiler: https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Buster/GCC%2010.2.0/Raspberry%20Pi%201%2C%20Zero/cross-gcc-10.2.0-pi_0-1.tar.gz
image: balenalib/raspberry-pi
- os: ubuntu-latest
dockerfile: Dockerfile.rpi
arch: armv7l
crosscompiler: https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Buster/GCC%2010.2.0/Raspberry%20Pi%202%2C%203/cross-gcc-10.2.0-pi_2-3.tar.gz
image: balenalib/raspberry-pi2
- os: ubuntu-latest
dockerfile: Dockerfile
arch: amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: git fetch --prune --unshallow --tags
- name: Build an image from Dockerfile
run: |
docker info
docker build -t docker.io/${{ github.repository }}:${{ github.base_ref || github.ref_name }}-${{ matrix.arch }} -f ${{ matrix.dockerfile }} --build-arg CROSSCOMPILER=${{ matrix.crosscompiler }} --build-arg ARCH=${{ matrix.arch }} --build-arg IMAGE=${{ matrix.image }} .
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Container Registry
run: |
docker push docker.io/${{ github.repository }}:${{ github.base_ref || github.ref_name }}-${{ matrix.arch }}
multiarch:
needs: build
runs-on: ubuntu-latest
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Publish multiarch image
env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
docker info
export TAG=${{ github.base_ref || github.ref_name }}
export MANIFEST=${TAG}
[ "$TAG" == "master" ] && export MANIFEST=latest
docker manifest create --amend docker.io/${{ github.repository }}:${MANIFEST} docker.io/${{ github.repository }}:${TAG}-amd64 docker.io/${{ github.repository }}:${TAG}-armv7l docker.io/${{ github.repository }}:${TAG}-armv6l docker.io/${{ github.repository }}:${TAG}-windows docker.io/${{ github.repository }}:${TAG}-arm64
docker manifest annotate docker.io/${{ github.repository }}:${MANIFEST} docker.io/${{ github.repository }}:${TAG}-armv7l --os linux --arch arm --variant v7
docker manifest annotate docker.io/${{ github.repository }}:${MANIFEST} docker.io/${{ github.repository }}:${TAG}-armv6l --os linux --arch arm --variant v6l
docker manifest push docker.io/${{ github.repository }}:${MANIFEST} -p