-
Notifications
You must be signed in to change notification settings - Fork 40
101 lines (98 loc) · 3.22 KB
/
docker-push.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
100
101
name: publish
on: push
jobs:
build-and-push-images:
strategy:
matrix:
app:
- name: neo4j
context: neo4j
file: neo4j/Dockerfile
target: community
suffix:
- name: backend
context: backend
file: backend/Dockerfile
target: base
suffix: -base
- name: backend
context: backend
file: backend/Dockerfile
target: code
suffix: -code
- name: backend
context: backend
file: backend/Dockerfile
target: production
suffix:
- name: webapp
context: webapp
file: webapp/Dockerfile
target: base
suffix: -base
- name: webapp
context: webapp
file: webapp/Dockerfile
target: code
suffix: -code
- name: webapp
context: webapp
file: webapp/Dockerfile
target: production
suffix:
- name: maintenance
context: webapp
file: webapp/Dockerfile.maintenance
target: base
suffix: -base
- name: maintenance
context: webapp
file: webapp/Dockerfile.maintenance
target: code
suffix: -code
- name: maintenance
context: webapp
file: webapp/Dockerfile.maintenance
target: production
suffix:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/${{ matrix.app.name }}
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.1.7
- name: Log in to the Container registry
uses: docker/#-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@70b2cdc6480c1a8b86edf1777157f8f437de2166
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=schedule,suffix=${{ matrix.app.suffix }}
type=semver,pattern={{version}},suffix=${{ matrix.app.suffix }}
type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.app.suffix }}
type=semver,pattern={{major}},suffix=${{ matrix.app.suffix }}
type=ref,event=branch,suffix=${{ matrix.app.suffix }}
type=ref,event=pr,suffix=${{ matrix.app.suffix }}
type=sha,suffix=${{ matrix.app.suffix }}
- name: Build and push Docker images
id: push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
with:
context: ${{ matrix.app.context }}
target: ${{ matrix.app.target }}
file: ${{ matrix.app.file }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}