Skip to content

Commit 5774e08

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
ci: simplify Docker workflow to ARM64-only slim build
1 parent 4923920 commit 5774e08

1 file changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build ARM64 Slim Docker Image (personal)
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- personal
8+
tags:
9+
- v*
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
14+
jobs:
15+
build-arm64-slim:
16+
runs-on: ubuntu-24.04-arm
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Prepare environment
23+
run: |
24+
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
25+
echo "FULL_IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
26+
27+
- name: Checkout repository
28+
uses: actions/checkout@v5
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Log in to the Container registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ${{ env.REGISTRY }}
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Extract metadata for Docker images
41+
id: meta
42+
uses: docker/metadata-action@v5
43+
with:
44+
images: ${{ env.FULL_IMAGE_NAME }}
45+
tags: |
46+
type=ref,event=branch
47+
type=ref,event=tag
48+
type=sha,prefix=git-
49+
type=semver,pattern={{version}}
50+
type=semver,pattern={{major}}.{{minor}}
51+
flavor: |
52+
latest=${{ github.ref == 'refs/heads/main' }}
53+
54+
- name: Extract metadata for Docker cache
55+
id: cache-meta
56+
uses: docker/metadata-action@v5
57+
with:
58+
images: ${{ env.FULL_IMAGE_NAME }}
59+
tags: |
60+
type=ref,event=branch
61+
${{ github.ref_type == 'tag' && 'type=raw,value=main' || '' }}
62+
flavor: |
63+
prefix=cache-arm64-slim-
64+
latest=false
65+
66+
- name: Build and push Docker image
67+
uses: docker/build-push-action@v5
68+
id: build
69+
with:
70+
context: .
71+
push: true
72+
platforms: linux/arm64
73+
tags: ${{ steps.meta.outputs.tags }}
74+
labels: ${{ steps.meta.outputs.labels }}
75+
cache-from: type=registry,ref=${{ steps.cache-meta.outputs.tags }}
76+
cache-to: type=registry,ref=${{ steps.cache-meta.outputs.tags }},mode=max
77+
build-args: |
78+
BUILD_HASH=${{ github.sha }}
79+
USE_SLIM=true
80+
81+
- name: Inspect image
82+
run: |
83+
docker buildx imagetools inspect ${{ env.FULL_IMAGE_NAME }}:${{ steps.meta.outputs.version }}

0 commit comments

Comments
 (0)