-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (95 loc) · 3.1 KB
/
docker-dev.yml
File metadata and controls
108 lines (95 loc) · 3.1 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Docker-Dev
on:
push:
branches:
- dev*
paths:
- docker/Dockerfile
- .github/workflows/docker-dev.yml
- ./scripts/*
env:
GHCR_SLUG: ghcr.io/${{ github.repository }}
jobs:
build:
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
tag: dev-amd64
- arch: arm64
runner: ubuntu-24.04-arm
tag: dev-arm64
runs-on: ${{ matrix.runner }}
outputs:
package_name: ${{ steps.get_package_name.outputs.package_name }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
- name: Set package name
id: get_package_name
run: |
PACKAGE_NAME="$(basename ${{ github.repository }})"
echo "package_name=$PACKAGE_NAME" >> $GITHUB_ENV
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
- name: Login to GitHub Container Registry (ghcr.io)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ env.GHCR_SLUG }}
# labels: |
# org.opencontainers.image.title=${{ env.package_name }}
# org.opencontainers.image.vendor=Jetsung Chan
# org.opencontainers.image.email=i@jetsung.com
# org.opencontainers.image.url=https://i.jetsung.com
# tags: ${{ matrix.tag }}
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Build (without push)
# uses: docker/bake-action@v6
# with:
# files: |
# ./docker-bake.hcl
# cwd://${{ steps.meta.outputs.bake-file }}
# targets: ${{ matrix.tag }}
# push: ${{ github.event_name != 'pull_request' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
platforms: linux/${{ matrix.arch }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.GHCR_SLUG }}:${{ matrix.tag }}
manifest:
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest
run: |
docker manifest create ${{ env.GHCR_SLUG }}:dev \
--amend ${{ env.GHCR_SLUG }}:dev-amd64 \
--amend ${{ env.GHCR_SLUG }}:dev-arm64
docker manifest push ${{ env.GHCR_SLUG }}:dev
shell: bash
- uses: actions/delete-package-versions@v5
continue-on-error: true
with:
package-name: ${{ needs.build.outputs.package_name }}
package-type: 'container'
min-versions-to-keep: 2
delete-only-untagged-versions: 'true'