Skip to content

Commit f760d6d

Browse files
authored
Build new docker image (#1494)
Build the new combined Docker image that serves both backend and frontend
1 parent bf8e4f0 commit f760d6d

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

.github/workflows/docker-build.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: docker
22

33
permissions:
44
contents: read
5+
packages: read
56

67
on:
78
workflow_dispatch:
@@ -10,6 +11,7 @@ on:
1011
- '.github/**'
1112
- 'backend/**'
1213
- 'frontend/**'
14+
- 'Dockerfile'
1315
- 'docker-compose.yml'
1416
push:
1517
branches:
@@ -18,9 +20,6 @@ on:
1820
jobs:
1921
build-and-push-image:
2022
runs-on: ubuntu-24.04
21-
permissions:
22-
contents: read
23-
packages: read
2423

2524
steps:
2625
- name: Checkout repository
@@ -35,8 +34,6 @@ jobs:
3534
context: frontend
3635
push: false
3736
file: frontend/Dockerfile
38-
tags: ${{ steps.meta_frontend.outputs.tags }}
39-
labels: ${{ steps.meta_frontend.outputs.labels }}
4037
# Don't build linux/arm64/v8 because it's very slow with QEMU
4138
platforms: linux/amd64
4239

@@ -46,7 +43,14 @@ jobs:
4643
context: backend
4744
push: false
4845
file: backend/Dockerfile
49-
tags: ${{ steps.meta_backend.outputs.tags }}
50-
labels: ${{ steps.meta_backend.outputs.labels }}
46+
# Don't build linux/arm64/v8 because it's very slow with QEMU
47+
platforms: linux/amd64
48+
49+
- name: Build combined Docker image
50+
uses: docker/build-push-action@v6
51+
with:
52+
context: ./
53+
push: false
54+
file: Dockerfile
5155
# Don't build linux/arm64/v8 because it's very slow with QEMU
5256
platforms: linux/amd64

.github/workflows/docker-publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
REGISTRY: ghcr.io
1414
IMAGE_NAME_FRONTEND: ${{ github.repository }}-frontend
1515
IMAGE_NAME_BACKEND: ${{ github.repository }}-backend
16+
IMAGE_NAME_COMBINED: ${{ github.repository }}
1617

1718
jobs:
1819
build-and-push-image:
@@ -50,6 +51,12 @@ jobs:
5051
with:
5152
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BACKEND }}
5253

54+
- name: Extract metadata (tags, labels) for combined Docker image
55+
id: meta_combined
56+
uses: docker/metadata-action@v5
57+
with:
58+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_COMBINED }}
59+
5360
- name: Build and push frontend Docker image
5461
uses: docker/build-push-action@v6
5562
with:
@@ -69,3 +76,13 @@ jobs:
6976
tags: ${{ steps.meta_backend.outputs.tags }}
7077
labels: ${{ steps.meta_backend.outputs.labels }}
7178
platforms: linux/amd64,linux/arm64/v8
79+
80+
- name: Build and push combined Docker image
81+
uses: docker/build-push-action@v6
82+
with:
83+
context: ./
84+
push: true
85+
file: Dockerfile
86+
tags: ${{ steps.meta_combined.outputs.tags }}
87+
labels: ${{ steps.meta_combined.outputs.labels }}
88+
platforms: linux/amd64,linux/arm64/v8

0 commit comments

Comments
 (0)