Skip to content

Commit

Permalink
Docker build support of secrets (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet authored Mar 29, 2024
1 parent f258037 commit 06e4375
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ on:
required: false
type: boolean
default: true
secrets:
required: false
type: string
secrets:
REGISTRY_LOGIN:
required: false
Expand Down Expand Up @@ -94,3 +97,4 @@ jobs:
no-cache: ${{ inputs.no-cache }}
build-args: ${{ inputs.build-args }}
file: ${{ env.FILE }}
secrets: ${{ inputs.secrets }}
8 changes: 8 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ jobs:
with:
context: tests/docker
name: test
docker-build-with-secrets:
uses: ./.github/workflows/docker-build.yaml
with:
context: tests/docker-secrets
name: test-secrets
secrets: |
my_secret=toto
my_other_secret=tata
trivy:
needs: docker-build
Expand Down
10 changes: 10 additions & 0 deletions tests/docker-secrets/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu

RUN --mount=type=secret,id=my_secret \
cat /run/secrets/my_secret

RUN --mount=type=secret,id=my_other_secret \
cat /run/secrets/my_other_secret

RUN apt-get update && apt-get install -y \
git

0 comments on commit 06e4375

Please sign in to comment.