This repository was archived by the owner on Sep 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
80 lines (73 loc) · 2.96 KB
/
docker.yml
File metadata and controls
80 lines (73 loc) · 2.96 KB
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
name: "Build and push docker image"
on:
workflow_call:
inputs:
tag:
required: true
description: The docker tag to use.
type: string
jobs:
# We build the binaries outside of docker because here we can parallelize.
build_docker_image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- bin: taker
target: x86_64-unknown-linux-gnu
os: ubuntu-latest
docker_arch: amd64
- bin: taker
target: aarch64-unknown-linux-gnu
os: ubuntu-latest
docker_arch: arm64
- bin: maker
target: x86_64-unknown-linux-gnu
os: ubuntu-latest
docker_arch: amd64
- bin: maker
target: aarch64-unknown-linux-gnu
os: ubuntu-latest
docker_arch: arm64
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-release-binary
id: build
with:
target: ${{ matrix.target }}
gh_token: ${{ secrets.ITCHY_GITHUB_TOKEN }}
binary: ${{ matrix.bin }}
- name: Login into github registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
run: |
docker build --platform linux/${{ matrix.docker_arch }} --pull --build-arg BINARY_PATH=./target/${{ matrix.target }}/release/${{ matrix.bin }} --tag ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }}-${{ matrix.docker_arch }} .
docker push ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }}-${{ matrix.docker_arch }}
create_manifest_image:
needs: build_docker_image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
bin: [maker, taker]
steps:
- name: Login into github registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
docker manifest create --amend ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }} ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }}-amd64 ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }}-arm64
docker manifest annotate ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }} ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }}-amd64 --os linux --arch amd64
docker manifest annotate ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }} ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }}-arm64 --os linux --arch arm64 --variant v8
docker manifest push ghcr.io/${{ github.repository }}/${{matrix.bin}}:${{ inputs.tag }} -p