File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 7
7
paths :
8
8
- ' build/dockerfile'
9
9
- ' build/requirements.txt'
10
+ - ' build/docker-compose.yml'
10
11
- ' .github/workflows/build-docker-image.yml'
11
12
12
13
jobs :
13
14
build-and-push :
14
15
runs-on : ubuntu-latest
16
+ permissions :
17
+ contents : read
18
+ packages : write
15
19
16
20
steps :
17
21
- name : Checkout repository
18
22
uses : actions/checkout@v4
19
23
24
+ - name : Docker metadata
25
+ id : meta
26
+ uses : docker/metadata-action@v5
27
+ with :
28
+ images : ghcr.io/${{ toLower(github.repository) }}
29
+ tags : |
30
+ type=raw,value=latest,enable={{is_default_branch}}
31
+ type=sha
32
+
33
+ - name : Set up Docker buildx
34
+ uses : docker/setup-buildx-action@v3
35
+
20
36
- name : Log in to GitHub Container Registry
21
37
uses : docker/login-action@v3
22
38
with :
23
39
registry : ghcr.io
24
40
username : ${{ github.actor }}
25
41
password : ${{ secrets.GITHUB_TOKEN }}
26
42
27
- - name : Build and push docker image
28
- uses : docker/build-push -action@v5
43
+ - name : Build and push via Docker compose
44
+ uses : docker/bake -action@v5
29
45
with :
30
- context : ./
31
- dockerfile : build/dockerfile
46
+ files : build/docker-compose.yml
47
+ targets : app
48
+ set : |
49
+ *.tags=${{ steps.meta.outputs.tags }}
50
+ *.labels=${{ steps.meta.outputs.labels }}
32
51
push : true
33
- tags : ghcr.io/${{ github.repository }}:${{ github.sha }}, ghcr.io/${{ github.repository }}:latest
52
+
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ version: '3.8'
2
2
3
3
services :
4
4
backend :
5
+ build :
6
+ context : .
7
+ dockerfile : build/dockerfile
5
8
image : ghcr.io/pyhpc/pyhpc-tutorial:latest
6
9
pull_policy : always
7
10
ulimits :
You can’t perform that action at this time.
0 commit comments