1

I am using the following project as a baseline to create a Docker container action.

The problem that I have is that I need to be able to access my secrets inside my Dockerfile. I tried almost all the tricks that I knew.

Retrieve the secret

RUN --mount=type=secret,id=API_ENDPOINT \
   export API_ENDPOINT=$(cat /run/secrets/API_ENDPOINT) 

Docker build is not happy because the --mount option requires BuildKit. I tried to set DOCKER_BUILDKIT=1, but I had zero success.

How can I pass the secrets? I created an env var at the top of my action (global), and all the steps have complete visibility of that secret.

env:
  API_ENDPOINT: ${{secrets.API_ENDPOINT}}
Khimaira
  • 11
  • 3
  • Are you sure that you need to create an action inside a container, rather than run arbitrary container commands? See https://stackoverflow.com/questions/64364989/github-actions-how-to-run-test-inside-container/64373702#64373702 – DannyB Apr 09 '22 at 12:32
  • Please show what you tried and what errors you got. We don't know what "almost all the tricks I knew" means :) – rethab Apr 11 '22 at 05:58

0 Answers0