Skip to content

Commit 8955f68

Browse files
committed
Add throwaway workflow to test the dual image build
Mirrors both release.yml image jobs so the public/private split can be exercised on demand without cutting a release. Pushes dev-<sha> to the public and private Artifactory repos. Delete once verified. Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
1 parent 9d6e215 commit 8955f68

2 files changed

Lines changed: 73 additions & 6 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: TEMP test dual build
2+
3+
# Throwaway: mirrors the two release.yml image jobs so the public/private split
4+
# can be exercised without cutting a release. Same tag, two Artifactory repos.
5+
# Delete once verified.
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [sd/hardened-images]
10+
paths:
11+
- '.github/workflows/tmp-test-dual-build.yml'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
public:
18+
name: Dev image on public bases
19+
uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
20+
permissions:
21+
id-token: write
22+
contents: read
23+
with:
24+
artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
25+
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
26+
image_artifact_name: trueforge
27+
image_tag: dev-${{ github.sha }}
28+
image_context: .
29+
dockerfile_path: Dockerfile
30+
platforms: linux/amd64
31+
enable_jfrog: true
32+
enable_public_ecr: false
33+
secrets:
34+
artifactory_username: ${{ secrets.TRUEFORGE_ARTIFACTORY_USERNAME }}
35+
artifactory_password: ${{ secrets.TRUEFORGE_ARTIFACTORY_PASSWORD }}
36+
37+
private:
38+
name: Dev image on hardened bases
39+
uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main
40+
permissions:
41+
id-token: write
42+
contents: read
43+
with:
44+
artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}
45+
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_REPOSITORY }}
46+
image_artifact_name: trueforge
47+
image_tag: dev-${{ github.sha }}
48+
image_context: .
49+
dockerfile_path: Dockerfile
50+
platforms: linux/amd64
51+
enable_jfrog: true
52+
enable_public_ecr: false
53+
enable_private_ecr_pull: true
54+
private_ecr_pull_registry: 526077812922.dkr.ecr.us-east-1.amazonaws.com
55+
image_build_args: |
56+
BUILD_BASE_IMAGE=${{ vars.TRUEFORGE_NODE_BUILD_BASE_IMAGE || '526077812922.dkr.ecr.us-east-1.amazonaws.com/tfy-internal/node:24-dev' }}
57+
RUNTIME_BASE_IMAGE=${{ vars.TRUEFORGE_NODE_RUNTIME_BASE_IMAGE || '526077812922.dkr.ecr.us-east-1.amazonaws.com/tfy-internal/node:24' }}
58+
secrets:
59+
artifactory_username: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_USERNAME }}
60+
artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_PASSWORD }}
61+
private_ecr_pull_role_arn: ${{ secrets.AWS_DEVTEST_ECR_IAM_ROLE_ARN }}

‎Dockerfile‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,25 @@ COPY --from=frontend-builder /app/packages/frontend/dist ./packages/trueforge/di
121121

122122
WORKDIR /app/packages/trueforge
123123

124-
# Chart pods run as uid 10001. Debian has groupadd; the hardened base has BusyBox.
124+
# Chart pods run as uid 10001. Debian has groupadd; the hardened base has
125+
# BusyBox addgroup. Fail loudly if a future base has neither, rather than on a
126+
# bare "not found".
125127
RUN if [ -x /usr/sbin/groupadd ]; then \
126128
groupadd --gid 10001 trueforge \
127129
&& useradd --uid 10001 --gid trueforge trueforge; \
128-
else \
130+
elif command -v addgroup >/dev/null 2>&1 && command -v adduser >/dev/null 2>&1; then \
129131
addgroup -g 10001 trueforge \
130132
&& adduser -D -H -u 10001 -G trueforge trueforge; \
133+
else \
134+
echo "base image has neither groupadd nor addgroup; cannot create uid 10001" >&2; \
135+
exit 1; \
131136
fi
132137

133138
EXPOSE 8790
134139

135140
USER 10001:10001
136-
# The hardened base sets ENTRYPOINT to the node binary. Pin the same command on
137-
# both bases so CMD is not passed to that binary as a script name.
138-
ENTRYPOINT ["node"]
139-
CMD ["dist/main.js"]
141+
# The hardened base sets ENTRYPOINT to the node binary, the Docker Hub base to
142+
# docker-entrypoint.sh. Clear it so CMD is the whole command on both, and a
143+
# `command:` override stays a command rather than arguments to node.
144+
ENTRYPOINT []
145+
CMD ["node", "dist/main.js"]

0 commit comments

Comments
 (0)