Skip to content

Commit 07ec9d9

Browse files
Copilotcommjoen
andcommitted
Restore secret mount functionality for challenge compatibility
Co-authored-by: commjoen <[email protected]>
1 parent 9d44c36 commit 07ec9d9

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

.github/scripts/docker-create.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,10 @@ create_containers() {
379379
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets:$tag-k8s-vault --build-arg "$buildarg" --build-arg "PORT=8081" --build-arg "argBasedVersion=$tag" --build-arg "spring_profile=kubernetes-vault" --secret id=mysecret,env=SECRET_VALUE --push ./../../.
380380
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets:latest-k8s-vault --build-arg "$buildarg" --build-arg "PORT=8081" --build-arg "argBasedVersion=$tag" --build-arg "spring_profile=kubernetes-vault" --secret id=mysecret,env=SECRET_VALUE --push ./../../.
381381
cd ../..
382-
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop:$tag -f Dockerfile_webdesktop --push .
383-
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop:latest -f Dockerfile_webdesktop --push .
384-
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop-k8s:$tag -f Dockerfile_webdesktopk8s --push .
385-
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop-k8s:latest -f Dockerfile_webdesktopk8s --push .
382+
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop:$tag -f Dockerfile_webdesktop --secret id=mysecret,env=SECRET_VALUE --push .
383+
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop:latest -f Dockerfile_webdesktop --secret id=mysecret,env=SECRET_VALUE --push .
384+
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop-k8s:$tag -f Dockerfile_webdesktopk8s --secret id=mysecret,env=SECRET_VALUE --push .
385+
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-desktop-k8s:latest -f Dockerfile_webdesktopk8s --secret id=mysecret,env=SECRET_VALUE --push .
386386
cd k8s/challenge53
387387
cp ../../src/main/resources/executables/wrongsecrets-challenge53-* ./executables
388388
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t jeroenwillemsen/wrongsecrets-challenge53:$tag -f Dockerfile --push .

.github/workflows/pr-desktop-containers.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ jobs:
9292
type=ref,event=pr,suffix=-{{sha}}
9393
type=ref,event=pr
9494
95+
- name: Create secret file for build
96+
run: |
97+
echo "wrongsecret-3" > /tmp/mysecret.txt
98+
9599
- name: Build and push Docker image
96100
id: build
97101
uses: docker/build-push-action@v6
@@ -104,6 +108,8 @@ jobs:
104108
labels: ${{ steps.meta.outputs.labels }}
105109
build-args: |
106110
argBasedVersion=${{ steps.extract-version.outputs.docker_version }}
111+
secrets: |
112+
mysecret=/tmp/mysecret.txt
107113
cache-from: type=gha,scope=${{ matrix.container.name }}-pr
108114
cache-to: type=gha,mode=max,scope=${{ matrix.container.name }}-pr
109115

Dockerfile_webdesktop

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ RUN \
3232

3333
WORKDIR /config/Desktop
3434

35+
# Add secret handling for challenge functionality
36+
# Create the /app directory to store the secret
37+
RUN mkdir -p /app
38+
39+
# Use a separate RUN command for --mount
40+
RUN --mount=type=secret,id=mysecret \
41+
export SECRET_VALUE=$(cat /run/secrets/mysecret) && \
42+
echo $SECRET_VALUE >> /app/secret.txt
43+
3544
# Create directories for copied files
3645
RUN mkdir -p /var/tmp/wrongsecrets /var/tmp/wrongsecrets/decrypt
3746

Dockerfile_webdesktopk8s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ RUN \
3737

3838
WORKDIR /config/Desktop
3939

40+
# Add secret handling for challenge functionality
41+
# Create the /app directory to store the secret
42+
RUN mkdir -p /app
43+
44+
# Use a separate RUN command for --mount
45+
RUN --mount=type=secret,id=mysecret \
46+
export SECRET_VALUE=$(cat /run/secrets/mysecret) && \
47+
echo $SECRET_VALUE >> /app/secret.txt
48+
4049
# Create directories for copied files
4150
RUN mkdir -p /var/tmp/wrongsecrets /var/tmp/wrongsecrets/decrypt
4251

0 commit comments

Comments
 (0)