Skip to content

Commit b11db87

Browse files
committed
fix: ci
1 parent 1e8bf1f commit b11db87

File tree

2 files changed

+29
-49
lines changed

2 files changed

+29
-49
lines changed

.github/workflows/docker-release.yaml

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ jobs:
1717
contents: read
1818
packages: write
1919

20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
image:
24+
- name: api
25+
repository: ghcr.io/socialgouv/no-package-malware-api
26+
target: api-runtime
27+
- name: app
28+
repository: ghcr.io/socialgouv/no-package-malware-app
29+
target: app-runtime
30+
- name: registry
31+
repository: ghcr.io/socialgouv/no-package-malware-registry
32+
target: registry-runtime
33+
2034
steps:
2135
- name: Checkout repository
2236
uses: actions/checkout@v5
@@ -37,11 +51,11 @@ jobs:
3751
username: ${{ github.actor }}
3852
password: ${{ secrets.GITHUB_TOKEN }}
3953

40-
- name: Extract metadata (tags, labels) for API image
41-
id: meta-api
54+
- name: Extract metadata (tags, labels)
55+
id: meta
4256
uses: docker/metadata-action@v5
4357
with:
44-
images: ghcr.io/socialgouv/no-package-malware-api
58+
images: ${{ matrix.image.repository }}
4559
tags: |
4660
type=schedule
4761
type=ref,event=branch
@@ -52,52 +66,14 @@ jobs:
5266
type=sha
5367
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
5468
55-
- name: Extract metadata (tags, labels) for App image
56-
id: meta-app
57-
uses: docker/metadata-action@v5
58-
with:
59-
images: ghcr.io/socialgouv/no-package-malware-app
60-
tags: ${{ steps.meta-api.outputs.tags }}
61-
62-
- name: Extract metadata (tags, labels) for Registry image
63-
id: meta-registry
64-
uses: docker/metadata-action@v5
65-
with:
66-
images: ghcr.io/socialgouv/no-package-malware-registry
67-
tags: ${{ steps.meta-api.outputs.tags }}
68-
69-
- name: Build and push API image
70-
uses: docker/build-push-action@v6
71-
with:
72-
context: .
73-
file: Dockerfile
74-
target: api-runtime
75-
push: true
76-
tags: ${{ steps.meta-api.outputs.tags }}
77-
labels: ${{ steps.meta-api.outputs.labels }}
78-
build-args: |
79-
VERSION=${{ steps.get_tag.outputs.GIT_TAG }}
80-
81-
- name: Build and push App image
82-
uses: docker/build-push-action@v6
83-
with:
84-
context: .
85-
file: Dockerfile
86-
target: app-runtime
87-
push: true
88-
tags: ${{ steps.meta-app.outputs.tags }}
89-
labels: ${{ steps.meta-app.outputs.labels }}
90-
build-args: |
91-
VERSION=${{ steps.get_tag.outputs.GIT_TAG }}
92-
93-
- name: Build and push Registry image
69+
- name: Build and push ${{ matrix.image.name }} image
9470
uses: docker/build-push-action@v6
9571
with:
9672
context: .
9773
file: Dockerfile
98-
target: registry-runtime
74+
target: ${{ matrix.image.target }}
9975
push: true
100-
tags: ${{ steps.meta-registry.outputs.tags }}
101-
labels: ${{ steps.meta-registry.outputs.labels }}
76+
tags: ${{ steps.meta.outputs.tags }}
77+
labels: ${{ steps.meta.outputs.labels }}
10278
build-args: |
10379
VERSION=${{ steps.get_tag.outputs.GIT_TAG }}

Dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ ENV NODE_ENV=production \
4242
# Copy built repo and dependencies from builder
4343
COPY --from=builder /app /app
4444

45-
# Create unprivileged user with numeric UID for Kubernetes policies
46-
RUN useradd -u 1000 -r -s /usr/sbin/nologin appuser && \
45+
# Create unprivileged user with numeric UID for Kubernetes policies (if needed)
46+
RUN if ! id -u 1000 >/dev/null 2>&1; then \
47+
useradd -u 1000 -r -s /usr/sbin/nologin appuser; \
48+
fi && \
4749
chown -R 1000:1000 /app
4850

4951
USER 1000
@@ -92,8 +94,10 @@ ENV NODE_ENV=production \
9294
# Copy built repo and dependencies from builder (includes Verdaccio plugins)
9395
COPY --from=builder /app /app
9496

95-
# Create unprivileged user with numeric UID for Kubernetes policies
96-
RUN useradd -u 1001 -r -s /usr/sbin/nologin registry && \
97+
# Create unprivileged user with numeric UID for Kubernetes policies (if needed)
98+
RUN if ! id -u 1001 >/dev/null 2>&1; then \
99+
useradd -u 1001 -r -s /usr/sbin/nologin registry; \
100+
fi && \
97101
chown -R 1001:1001 /app
98102

99103
USER 1001

0 commit comments

Comments
 (0)