Skip to content

Commit 06e4375

Browse files
authored
Docker build support of secrets (#60)
1 parent f258037 commit 06e4375

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.github/workflows/docker-build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ on:
5252
required: false
5353
type: boolean
5454
default: true
55+
secrets:
56+
required: false
57+
type: string
5558
secrets:
5659
REGISTRY_LOGIN:
5760
required: false
@@ -94,3 +97,4 @@ jobs:
9497
no-cache: ${{ inputs.no-cache }}
9598
build-args: ${{ inputs.build-args }}
9699
file: ${{ env.FILE }}
100+
secrets: ${{ inputs.secrets }}

.github/workflows/tests.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ jobs:
1212
with:
1313
context: tests/docker
1414
name: test
15+
docker-build-with-secrets:
16+
uses: ./.github/workflows/docker-build.yaml
17+
with:
18+
context: tests/docker-secrets
19+
name: test-secrets
20+
secrets: |
21+
my_secret=toto
22+
my_other_secret=tata
1523
1624
trivy:
1725
needs: docker-build

tests/docker-secrets/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ubuntu
2+
3+
RUN --mount=type=secret,id=my_secret \
4+
cat /run/secrets/my_secret
5+
6+
RUN --mount=type=secret,id=my_other_secret \
7+
cat /run/secrets/my_other_secret
8+
9+
RUN apt-get update && apt-get install -y \
10+
git

0 commit comments

Comments
 (0)