Skip to content

Commit b819890

Browse files
Refactor Docker build workflow for frontend
1 parent 0449f46 commit b819890

File tree

1 file changed

+10
-25
lines changed

1 file changed

+10
-25
lines changed

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

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,11 @@ jobs:
3535
platform: linux/arm64
3636

3737
steps:
38-
- name: Checkout repository
39-
uses: actions/checkout@v6
38+
- uses: actions/checkout@v6
4039
with:
4140
fetch-depth: 0
4241

43-
- name: Set up Node.js
44-
uses: actions/setup-node@v6
42+
- uses: actions/setup-node@v6
4543
with:
4644
node-version: latest
4745

@@ -52,8 +50,7 @@ jobs:
5250
GITHUB_REF_NAME: ${{ github.ref_name }}
5351
GITHUB_REF_TYPE: ${{ github.ref_type }}
5452

55-
- name: Log in to the Container registry
56-
uses: docker/login-action@v4
53+
- uses: docker/login-action@v4
5754
with:
5855
registry: ${{ env.REGISTRY }}
5956
username: ${{ github.actor }}
@@ -66,14 +63,11 @@ jobs:
6663
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6764
annotations: |
6865
org.opencontainers.image.title=Frontend Image
69-
org.opencontainers.image.description=Frontend build for ${{ github.repository }} (${{
70-
github.ref_name }})
66+
org.opencontainers.image.description=Frontend build for ${{ github.repository }} (${{ github.ref_name }})
7167
org.opencontainers.image.source=https://github.com/${{ github.repository }}
7268
org.opencontainers.image.revision=${{ github.sha }}
73-
org.opencontainers.image.licenses=MIT
7469
75-
- name: Set up Docker Buildx
76-
uses: docker/setup-buildx-action@v4
70+
- uses: docker/setup-buildx-action@v4
7771

7872
- name: Build and push by digest
7973
id: build
@@ -90,8 +84,7 @@ jobs:
9084
digest="${{ steps.build.outputs.digest }}"
9185
touch "/tmp/digests/${digest#sha256:}"
9286
93-
- name: Upload digest
94-
uses: actions/upload-artifact@v7
87+
- uses: actions/upload-artifact@v7
9588
with:
9689
name: digests-${{ matrix.platform == 'linux/amd64' && 'amd64' || 'arm64' }}
9790
path: /tmp/digests/*
@@ -103,15 +96,13 @@ jobs:
10396
if: startsWith(github.ref, 'refs/tags/v')
10497

10598
steps:
106-
- name: Download digests
107-
uses: actions/download-artifact@v8
99+
- uses: actions/download-artifact@v8
108100
with:
109101
path: /tmp/digests
110102
pattern: digests-*
111103
merge-multiple: true
112104

113-
- name: Log in to the Container registry
114-
uses: docker/login-action@v4
105+
- uses: docker/login-action@v4
115106
with:
116107
registry: ${{ env.REGISTRY }}
117108
username: ${{ github.actor }}
@@ -127,20 +118,14 @@ jobs:
127118
type=semver,pattern={{version}}
128119
type=raw,value=latest,enable=${{ github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') }}
129120
130-
- name: Set up Docker Buildx
131-
uses: docker/setup-buildx-action@v4
121+
- uses: docker/setup-buildx-action@v4
132122

133123
- name: Create manifest list and push
134124
working-directory: /tmp/digests
135125
run: |
136-
TAG_ARGS=$(echo "${{ steps.meta.outputs.tags }}" | xargs -I {} echo "-t {}")
126+
TAG_ARGS=$(echo "${{ steps.meta.outputs.tags }}" | sort -u | xargs -I {} echo "-t {}")
137127
DIGEST_ARGS=$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
138128
139129
docker buildx imagetools create \
140130
$TAG_ARGS \
141-
--annotation org.opencontainers.image.title="Frontend Image" \
142-
--annotation org.opencontainers.image.description="Frontend build for ${{ github.repository }} (${{ github.ref_name }})" \
143-
--annotation org.opencontainers.image.source="https://github.com/${{ github.repository }}" \
144-
--annotation org.opencontainers.image.revision="${{ github.sha }}" \
145-
--annotation org.opencontainers.image.licenses="MIT" \
146131
$DIGEST_ARGS

0 commit comments

Comments
 (0)