Azure / Azure/container-apps-deploy-action
Passing env variables to docker build
- Dominant language
- TypeScript
- Stars
- 94
- Forks
- 51
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 1
Description
Hi there,
I am trying to use the container-apps-adeploy-action for a nextjs application, specifically Tina.io.
Tina requires three env variables to be set when building, which I locally set in a .env with the variables `NEXT_PUBLIC_TINA_CLIENT_ID`, `TINA_TOKEN` and `NEXT_PUBLIC_TINA_BRANCH`. This work nicely locally when I build the docker image.
In my GitHub action, I set them under `env` and read from GitHub secret. This is my workflow file:
```yaml
name: Azure Container App CI/CD
on:
push:
branches:
- main
env:
NEXT_PUBLIC_TINA_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_TINA_CLIENT_ID }}
TINA_TOKEN: ${{ secrets.TINA_TOKEN }}
NEXT_PUBLIC_TINA_BRANCH: main
jobs:
build_and_deploy_job:
runs-on: ubuntu-latest
name: Build and deploy job
steps:
- uses: actions/checkout@v3
- name: Log in to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Build and deploy Container App
uses: azure/container-apps-deploy-action@v0
with:
appSourcePath: ${{ github.workspace }}
acrName: KoermitApiRegistry
acrUsername: ${{ secrets.REGISTRY_USERNAME }}
acrPassword: ${{ secrets.REGISTRY_PASSWORD }}
containerAppName: tina-handbook
resourceGroup: tina-lab-handbook
containerAppEnvironment: labs-handbook
dockerfilePath: Dockerfile
```
However I get an error from the action build job
``` Error: Client not configured properly. Missing branch, clientId, token. Please visit https://tina.io/docs/tina-cloud/connecting-site/ for more information```
These values are set from the env variables `NEXT_PUBLIC_TINA_CLIENT_ID`, `TINA_TOKEN` and `NEXT_PUBLIC_TINA_BRANCH`.
Another log from the action, is this:
```
Run docker build --tag KoermitApiRegistry.azurecr.io/github-action/container-app:3550347084.1 --file /home/runner/work/tina-labs-handbook/tina-labs-handbook/Dockerfile /home/runner/work/tina-labs-handbook/tina-labs-handbook
[275](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:290)
docker build --tag KoermitApiRegistry.azurecr.io/github-action/container-app:3550347084.1 --file /home/runner/work/tina-labs-handbook/tina-labs-handbook/Dockerfile /home/runner/work/tina-labs-handbook/tina-labs-handbook
[276](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:291)
shell: /usr/bin/bash --noprofile --norc -e -o pipefail ***0***
[277](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:292)
env:
[278](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:293)
NEXT_PUBLIC_TINA_CLIENT_ID: ***
[279](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:294)
TINA_TOKEN: ***
[280](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:295)
NEXT_PUBLIC_TINA_BRANCH: main
[281](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:296)
AZURE_HTTP_USER_AGENT:
[282](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:297)
AZUREPS_HOST_ENVIRONMENT:
[283](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:298)
CA_GH_ACTION_ACR_LOGIN_ARG: --registry-server KoermitApiRegistry.azurecr.io --registry-username *** --registry***
[284](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:299)
CA_GH_ACTION_DOCKERFILE_PATH: /home/runner/work/tina-labs-handbook/tina-labs-handbook/Dockerfile
[285](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:300)
CA_GH_ACTION_IMAGE_TO_BUILD: KoermitApiRegistry.azurecr.io/github-action/container-app:3550347084.1
[286](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:301)
CA_GH_ACTION_IMAGE_TO_DEPLOY: KoermitApiRegistry.azurecr.io/github-action/container-app:3550347084.1
[287](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:302)
CA_GH_ACTION_RESOURCE_GROUP: tina-lab-handbook
[288](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:303)
CA_GH_ACTION_CONTAINER_APP_ENVIRONMENT_ARG: --environment labs-handbook
[289](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:304)
CA_GH_ACTION_RUNTIME_STACK: node:16
[290](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:305)
CA_GH_ACTION_TARGET_PORT:
[291](https://github.com/DanskeStatsbaner/tina-labs-handbook/actions/runs/3550347084/jobs/5963640559#step:4:307)
Sending build context to Docker daemon 1.143MB
```
Based on this, it looks as for me that the deploy action passes the correct env variables to docker, they are set and as far as I understand should be ready for `docker build` to read. Which is why I don't understand why the application throws the errors that the variables are not set/not configured.
Any ideas on what is going wrong? Thank you!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.