-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (82 loc) · 2.81 KB
/
Copy pathdocker.yaml
File metadata and controls
93 lines (82 loc) · 2.81 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
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Build Docker Image
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build Walnuts.dev Docker Image
strategy:
matrix:
include:
- key: linux-amd64
os: ubuntu-latest
platform: linux/amd64
- key: linux-arm64
os: ubuntu-24.04-arm
platform: linux/arm64
runs-on: ${{ matrix.os }}
steps:
- name: Check out
uses: actions/checkout@v6
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: walnuts1018
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
with:
version: latest
- name: Build and push Docker images
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
id: build
with:
context: .
platforms: ${{ matrix.platform }}
outputs: type=image,name=ghcr.io/walnuts1018/walnuts.dev,push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha,scope=${{ matrix.key }}
cache-to: type=gha,mode=max,scope=${{ matrix.key }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v6
with:
name: digests-${{ matrix.key }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download digests
uses: actions/download-artifact@v7
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Login to ghcr.io
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: walnuts1018
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Tag from Release
id: GetTag
run: echo "ImageTag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create \
-t ghcr.io/walnuts1018/walnuts.dev:latest \
-t ghcr.io/walnuts1018/walnuts.dev:${{ github.sha }}-${{ github.run_number }} \
$(printf 'ghcr.io/walnuts1018/walnuts.dev@sha256:%s ' *)