Skip to content

Commit 035bdcb

Browse files
committed
build verbeteren
1 parent f58a07d commit 035bdcb

File tree

2 files changed

+54
-14
lines changed

2 files changed

+54
-14
lines changed

.github/workflows/docker-build.yml

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,14 @@ env:
1111
REGISTRY: ghcr.io
1212

1313
jobs:
14-
build-and-push:
14+
build-base-sql:
1515
runs-on: ubuntu-latest
1616
permissions:
1717
contents: read
1818
packages: write
1919

20-
strategy:
21-
fail-fast: false # Zorgt dat als één image faalt, de andere wel doorgaat
22-
matrix:
23-
include:
24-
- image_name: custom-jupyter-sql
25-
dockerfile: ./docker/Dockerfile.base-sql
26-
- image_name: custom-jupyter-ai
27-
dockerfile: ./docker/Dockerfile.ai-ext
20+
outputs:
21+
base_tag: ${{ steps.meta.outputs.version }}
2822

2923
steps:
3024
- name: Checkout repository
@@ -44,7 +38,7 @@ jobs:
4438
id: meta
4539
uses: docker/metadata-action@v5
4640
with:
47-
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.image_name }}
41+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/custom-jupyter-sql
4842
tags: |
4943
type=semver,pattern={{version}}
5044
type=semver,pattern={{major}}.{{minor}}
@@ -54,10 +48,55 @@ jobs:
5448
uses: docker/build-push-action@v5
5549
with:
5650
context: .
57-
file: ${{ matrix.dockerfile }}
51+
file: ./docker/Dockerfile.base-sql
5852
push: true
5953
tags: ${{ steps.meta.outputs.tags }}
6054
labels: ${{ steps.meta.outputs.labels }}
6155
platforms: linux/amd64
6256
cache-from: type=gha
63-
cache-to: type=gha,mode=max
57+
cache-to: type=gha,mode=max
58+
59+
build-ai-ext:
60+
runs-on: ubuntu-latest
61+
permissions:
62+
contents: read
63+
packages: write
64+
needs: build-base-sql
65+
66+
steps:
67+
- name: Checkout repository
68+
uses: actions/checkout@v4
69+
70+
- name: Set up Docker Buildx
71+
uses: docker/setup-buildx-action@v3
72+
73+
- name: Log in to GHCR
74+
uses: docker/login-action@v3
75+
with:
76+
registry: ${{ env.REGISTRY }}
77+
username: ${{ github.actor }}
78+
password: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Extract metadata
81+
id: meta
82+
uses: docker/metadata-action@v5
83+
with:
84+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/custom-jupyter-ai
85+
tags: |
86+
type=semver,pattern={{version}}
87+
type=semver,pattern={{major}}.{{minor}}
88+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
89+
90+
- name: Build and push
91+
uses: docker/build-push-action@v5
92+
with:
93+
context: .
94+
file: ./docker/Dockerfile.ai-ext
95+
push: true
96+
tags: ${{ steps.meta.outputs.tags }}
97+
labels: ${{ steps.meta.outputs.labels }}
98+
platforms: linux/amd64
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max
101+
build-args: |
102+
BASE_TAG=${{ needs.build-base-sql.outputs.base_tag }}

docker/Dockerfile.ai-ext

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# We gebruiken het image dat we zojuist gebouwd hebben als bron
2-
FROM ghcr.io/dennismdejong/custom-jupyter-sql:1.0.4
1+
# Base image tag wordt doorgegeven via build argument
2+
ARG BASE_TAG=latest
3+
FROM ghcr.io/dennismdejong/custom-jupyter-sql:${BASE_TAG}
34

45
USER ${NB_UID}
56

0 commit comments

Comments
 (0)