-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mounting secret does not seem to work in GitHub workflow #3125
Comments
So try with |
Same issue persists even with |
To add some information, when I run |
Do you repro with: -
name: Build
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
secrets: |
"MY_SECRET=${{ secrets.MY_SECRET }}" |
Tried running it this way instead and get the same error. Checking length with wc, I still find the secret with same length, just can't access it later |
The issue was with how the secret was then handled in the Dockerfile. Mistake from my side with not realizing it does not persist between layers |
I'm trying to mount a GH secret when building a docker image as shown here. I'm running the job with:
and adding the variable from GH with:
When I run
echo $MY_SECRET
before docker build, I see the *** as output, suggesting the environment variable is set.My
Dockerfile
has the following lineRUN --mount=type=secret,id=MY_SECRET export MY_SECRET=$(cat /run/secrets/MY_SECRET)
, however, when I try to accessMY_SECRET
from a Python script further down, it can't find it.When I just run
RUN --mount=type=secret,id=MY_SECRET cat /run/secrets/MY_SECRET
, I get aNo such file or directory
error for/run/secrets/MY_SECRET
.The beginning of my Dockerfile looks like the following:
The text was updated successfully, but these errors were encountered: