fly deploy --build-secret, passing a file

Hello, I am trying to deploy my application using Fly. My Dockerfile uses several file secrets, that I can easily pass locally to the docker build command with the --secret flag and src parameter, for example:

docker build <...> id=aws,src=.config/aws/credentials 

This feature seems not to be supported by the flyctl deploy command. As far as I understood, it only supports env variables, so for the example above, I would have to pass something like:

flyctl deploy --build-secret AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} ...

My questions are:

  1. Is it correct that passing a file as a build secret is not supported yet
  2. What alternative would you recommend is for certain use-cases, I still need to pass a file? I thought about cat-ing my files’ content like this:
flyctl deploy <...> --build-secret super_secret=$(cat <credentials_file_path>)

Suggestion: look for “base64” on this page: Build Secrets · Fly Docs

You should find that string in two places: one in which you construct the build secret, and the second where you use that value.

1 Like

Thanks :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.