Use of Environment Variables in docker/build-push-action? #1097
Unanswered
colinbjohnson
asked this question in
Q&A
Replies: 1 comment
-
Inputs are not evaluated, this is a limitation on GitHub side, not this action. But you can use contexts to access variable values but it must be first applied to your job, not the step: https://docs.github.com/en/actions/learn-github-actions/variables#using-contexts-to-access-variable-values name: build-and-push-image
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
env:
REGISTRY: 123456789012.dkr.ecr.us-west-2.amazonaws.com
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: aws-actions/amazon-ecr-login@v2
- uses: docker/build-push-action@v5
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ env.REGISTRY }}/github-actions-lab:test |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am curious if Environment Variables are not supported as inputs by the docker/build-push-action. An example file is below:
Which results in an error:
If Environment Variables are not supported as inputs I feel like this might be worth mentioning in the documentation (or I missed it). I'd be happy to submit a PR if desired.
Beta Was this translation helpful? Give feedback.
All reactions