# I'm having a hard time passing env variables to Dockerfile when using GitHub actions

**URL:** <https://community.fly.io/t/im-having-a-hard-time-passing-env-variables-to-dockerfile-when-using-github-actions/2861>\
**Category:** General\
**Created:** [October 17, 2021, 3:20pm UTC](https://community.fly.io/t/im-having-a-hard-time-passing-env-variables-to-dockerfile-when-using-github-actions/2861 "2021-10-17T15:20:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.smith](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/a.smith/32/42996_2.png) [@a.smith](https://community.fly.io/u/a.smith)\
**Post date:** [October 17, 2021, 3:20pm UTC](https://community.fly.io/t/im-having-a-hard-time-passing-env-variables-to-dockerfile-when-using-github-actions/2861/1 "2021-10-17T15:20:44Z")

</div>

I’m trying to use GitHub actions to deploy my project but I’m having a hard time getting my secrets from GitHub into the docker container I’m using for my fly app. My project code is here with all the configs [GitHub - silentworks/lnkd](https://github.com/silentworks/lnkd), can someone point me in the right direction please.

---

<div class="post-metadata">

**Author:** ![michael](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/michael/32/16_2.png) [@michael](https://community.fly.io/u/michael)\
**Post date:** [October 17, 2021, 5:18pm UTC](https://community.fly.io/t/im-having-a-hard-time-passing-env-variables-to-dockerfile-when-using-github-actions/2861/2 "2021-10-17T17:18:04Z")

</div>

You should set runtime secrets manually with `flyctl secrets set` and leave the build secrets to GitHub. This way your secrets are encrypted in fly and not spread to multiple places.

---

<div class="post-metadata">

**Author:** ![a.smith](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/a.smith/32/42996_2.png) [@a.smith](https://community.fly.io/u/a.smith)\
**Post date:** [October 17, 2021, 8:22pm UTC](https://community.fly.io/t/im-having-a-hard-time-passing-env-variables-to-dockerfile-when-using-github-actions/2861/3 "2021-10-17T20:22:41Z")

</div>

I don’t think this answer is related to what I’m asking, I’m asking about build time env variables and how to pass them from the GitHub action to the fly build process. I’m using Dockerfile for my build and no matter how I pass the env variable on they don’t seem to get into the build process.

---

<div class="post-metadata">

**Author:** ![michael](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/michael/32/16_2.png) [@michael](https://community.fly.io/u/michael)\
**Post date:** [October 18, 2021, 2:16am UTC](https://community.fly.io/t/im-having-a-hard-time-passing-env-variables-to-dockerfile-when-using-github-actions/2861/4 "2021-10-18T02:16:44Z")

</div>

I see what you are saying, yes I misunderstood. The `args` property is passed through to flyctl, so you’d need to put them in the string, like

```auto
      - name: Deploy app
        uses: superfly/flyctl-actions@1.1
        with:
          args: 
            "deploy --build-arg ABC= ${{ secrets.ABC }}

```

I haven’t used GH actions in a while so it might have special interpolation rules you need to adjust for. I hope that helps.
