I’ve been trying to set an env variable from python script and pass it at build-arg but it doesn’t work.
echo
prints the info however the variable is not set in a container after build completed.
Here is the job I am using:
build-and-push-image-fe:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
command: |
pyenv global 3.7.0 && \
export VUE_APP_BACKEND_VERSION=$(python3 get_release_version.py) && \
echo $VUE_APP_BACKEND_VERSION >> $BASH_ENV && \
echo $VUE_APP_BACKEND_VERSION
- aws-ecr/build-and-push-image:
repo: "${REPO_NAME}"
tag: "fe-${CIRCLE_SHA1}"
path: "./"
dockerfile: "fe.Dockerfile"
extra-build-args: "--build-arg BASE_URL=$BASE_URL --build-arg VUE_APP_URL=$VUE_APP_URL --build-arg VUE_APP_AUTH_BASE_URL=$VUE_APP_AUTH_BASE_URL --build-arg VUE_APP_BACKEND_VERSION=$VUE_APP_BACKEND_VERSION"
And in the Dockerfile I have this:
ARG BASE_URL
ARG VUE_APP_URL
ARG VUE_APP_AUTH_BASE_URL
ARG VUE_APP_BACKEND_VERSION