Skip to content

Commit

Permalink
try to fix passing secret fron action to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaconsalvi committed Aug 19, 2024
1 parent 34a307a commit 73c1b25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-n-push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
file: src/main/docker/Dockerfile.multistage
tags: ghcr.io/${{ github.repository }}:${{ github.head_ref || github.ref_name }}
secrets: |
"GIT_USERNAME=${{ secrets.GIT_USER }}"
"GIT_PASSWORD=${{ secrets.GIT_PAT }}"
"git_user=${{ secrets.GIT_USER }}"
"git_pass=${{ secrets.GIT_PAT }}"
#
# Install Node.
#
Expand Down
8 changes: 4 additions & 4 deletions src/main/docker/Dockerfile.multistage
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ COPY --chown=quarkus:quarkus .mvn/ /code/.mvn
COPY --chown=quarkus:quarkus pom.xml /code/
USER quarkus
WORKDIR /code
RUN --mount=type=secret,id=GIT_USERNAME \
--mount=type=secret,id=GIT_PASSWORD \
export GIT_USERNAME=$(cat /run/secrets/GIT_USERNAME) && \
export GIT_PASSWORD=$(cat /run/secrets/GIT_PASSWORD) && \
RUN --mount=type=secret,id=git_user \
--mount=type=secret,id=git_pass \
export GIT_USER=$(cat /run/secrets/git_user) && \
export GIT_PASS=$(cat /run/secrets/git_pass) && \
yarn gen

RUN echo "<settings><servers><server><id>github</id><username>$env:GIT_USERNAME</username><password>$env:GIT_PASSWORD</password></server></servers></settings>" >> /root/.m2/settings.xml
Expand Down

0 comments on commit 73c1b25

Please sign in to comment.