-
Notifications
You must be signed in to change notification settings - Fork 32
99 lines (89 loc) · 3 KB
/
docker-build.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
name: Docker Build
on:
workflow_dispatch:
inputs:
version:
description: 'Version to build'
required: true
tag_as_latest:
description: 'Tag this version as latest'
type: boolean
default: true
required: false
jobs:
docker:
strategy:
matrix:
include:
- platform: linux/amd64
runner: ubicloud-standard-16 # AMD64 runner
- platform: linux/arm64
runner: ubicloud-standard-16-arm # ARM64 runner
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# This enables the docker driver with persistent worker
driver-opts: |
image=moby/buildkit:latest
network=host
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract platform info
id: platform
run: |
ARCH=${MATRIX_PLATFORM#*/}
echo "arch=$ARCH" >> $GITHUB_OUTPUT
env:
MATRIX_PLATFORM: ${{ matrix.platform }}
# Add cache metadata extraction
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: sequin/sequin
tags: |
type=semver,pattern={{version}},value=${{ inputs.version }}
${{ inputs.tag_as_latest == 'true' && 'type=raw,value=latest' || '' }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
push: true
build-args: |
SELF_HOSTED=1
RELEASE_VERSION=${{ inputs.version }}
tags: |
sequin/sequin:${{ inputs.version }}-${{ steps.platform.outputs.arch }}
cache-from: |
type=registry,ref=sequin/sequin:buildcache-${{ steps.platform.outputs.arch }}
cache-to: |
type=registry,ref=sequin/sequin:buildcache-${{ steps.platform.outputs.arch }},mode=max
provenance: false
sbom: false
create-manifest:
needs: docker
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create and push manifest
run: |
docker buildx imagetools create -t sequin/sequin:${{ inputs.version }} \
sequin/sequin:${{ inputs.version }}-amd64 \
sequin/sequin:${{ inputs.version }}-arm64
if [[ "${{ inputs.tag_as_latest }}" == "true" ]]; then
docker buildx imagetools create -t sequin/sequin:latest \
sequin/sequin:${{ inputs.version }}-amd64 \
sequin/sequin:${{ inputs.version }}-arm64
fi