Skip to content

Commit 41b560c

Browse files
committed
Use docker compose to build the container
1 parent 7ec5a5c commit 41b560c

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/build-docker-image.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,46 @@ on:
77
paths:
88
- 'build/dockerfile'
99
- 'build/requirements.txt'
10+
- 'build/docker-compose.yml'
1011
- '.github/workflows/build-docker-image.yml'
1112

1213
jobs:
1314
build-and-push:
1415
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
1519

1620
steps:
1721
- name: Checkout repository
1822
uses: actions/checkout@v4
1923

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+
2036
- name: Log in to GitHub Container Registry
2137
uses: docker/login-action@v3
2238
with:
2339
registry: ghcr.io
2440
username: ${{ github.actor }}
2541
password: ${{ secrets.GITHUB_TOKEN }}
2642

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
2945
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 }}
3251
push: true
33-
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}, ghcr.io/${{ github.repository }}:latest
52+

build/jupyterlab-docker-compose.yml renamed to build/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ version: '3.8'
22

33
services:
44
backend:
5+
build:
6+
context: .
7+
dockerfile: build/dockerfile
58
image: ghcr.io/pyhpc/pyhpc-tutorial:latest
69
pull_policy: always
710
ulimits:

0 commit comments

Comments
 (0)