-
-
Notifications
You must be signed in to change notification settings - Fork 48
76 lines (64 loc) · 1.98 KB
/
publish-container-image.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
name: Publish Docker container image to Docker Hub
on:
push:
branches:
- next
tags:
- v*
jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract tags and labels
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}
- name: Build container image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
tags: local:test
labels: ${{ steps.meta.outputs.labels }}
load: true
- name: Test container image
run: docker run --rm -v $PWD:/workdir local:test "*.md"
- name: Push container image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
- name: Extract tags and labels for -rules
id: meta-rules
uses: docker/metadata-action@v5
with:
images: ${{ github.repository }}-rules
- name: Build and push container image for -rules
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile-rules
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta-rules.outputs.tags }}
labels: ${{ steps.meta-rules.outputs.labels }}
build-args: |
VERSION=${{ steps.meta.outputs.version }}
push: true