Skip to content

Commit 3d8f56a

Browse files
authored
Merge pull request #38 from LibreCodeCoop/codex/find-daily-usage-of-build-workflow
Split GitHub Actions workflow to publish separate app and web Docker images
2 parents ba0673b + c57a1cd commit 3d8f56a

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

.github/workflows/docker-image.yml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ on:
1313

1414
env:
1515
REGISTRY: ghcr.io
16-
IMAGE_NAME: ${{ github.repository }}
16+
IMAGE_NAME_APP: ${{ github.repository }}-app
17+
IMAGE_NAME_WEB: ${{ github.repository }}-web
1718

1819
jobs:
1920
build:
@@ -37,26 +38,50 @@ jobs:
3738
username: ${{ github.actor }}
3839
password: ${{ secrets.GITHUB_TOKEN }}
3940

40-
- name: Extract metadata
41-
id: meta
41+
- name: Extract metadata (app)
42+
id: meta_app
4243
uses: docker/metadata-action@v5
4344
with:
44-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_APP }}
4546
tags: |
4647
type=ref,event=branch
4748
type=ref,event=pr
4849
type=sha,prefix={{branch}}-
4950
type=raw,value=latest,enable={{is_default_branch}}
5051
type=semver,pattern={{version}}
5152
type=semver,pattern={{major}}.{{minor}}
52-
53-
- name: Build and push Docker image
53+
54+
- name: Build and push Docker image (app)
55+
uses: docker/build-push-action@v6
56+
with:
57+
context: .docker/app
58+
platforms: linux/amd64,linux/arm64
59+
push: true
60+
tags: ${{ steps.meta_app.outputs.tags }}
61+
labels: ${{ steps.meta_app.outputs.labels }}
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
65+
- name: Extract metadata (web)
66+
id: meta_web
67+
uses: docker/metadata-action@v5
68+
with:
69+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_WEB }}
70+
tags: |
71+
type=ref,event=branch
72+
type=ref,event=pr
73+
type=sha,prefix={{branch}}-
74+
type=raw,value=latest,enable={{is_default_branch}}
75+
type=semver,pattern={{version}}
76+
type=semver,pattern={{major}}.{{minor}}
77+
78+
- name: Build and push Docker image (web)
5479
uses: docker/build-push-action@v6
5580
with:
56-
context: .
81+
context: .docker/web
5782
platforms: linux/amd64,linux/arm64
5883
push: true
59-
tags: ${{ steps.meta.outputs.tags }}
60-
labels: ${{ steps.meta.outputs.labels }}
84+
tags: ${{ steps.meta_web.outputs.tags }}
85+
labels: ${{ steps.meta_web.outputs.labels }}
6186
cache-from: type=gha
6287
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)