I've been working on setting up a Github Actions workflow to build a docker image. I need to pass environment variables into the image so that my Django project will run correctly. Unfortunately, when I build the image it doesn't receive the values of the variables.
The relevant part of my workflow file:
- name: Build, tag, and push image to AWS ECR id: build-image env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} IMAGE_TAG: ${{ github.sha }} aws_ses_access_key_id: ${{ secrets.AWS_SES_ACCESS_KEY_ID }} aws_ses_secret_access_key: ${{ secrets.AWS_SES_SECRET_ACCESS_KEY }} DATABASE_ENGINE: ${{ secrets.DATABASE_ENGINE }} db_host: ${{ secrets.DB_HOST }} db_password: ${{ secrets.DB_PASSWORD }} db_port: ${{ secrets.DB_PORT }} db_username: ${{ secrets.DB_USERNAME }} django_secret_key: ${{ secrets.DJANGO_SECRET_KEY }} fcm_server_key: ${{ secrets.FCM_SERVER_KEY }} run: | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV In my Dockerfile, I've put the following:
ENV aws_ses_access_key_id=$aws_ses_access_key_id aws_ses_secret_access_key=$aws_ses_secret_access_key DATABASE_ENGINE=$DATABASE_ENGINE db_host=$db_host db_password=$db_password db_port=$db_port db_username=$db_username django_secret_key=$django_secret_key fcm_server_key=$fcm_server_key None of the variables are passing. I've tried using $variable_name and ${variable_name} with no luck. What am I doing wrong?