Trying to pass runtime Environment variable from Cloud Run > Variables Environment variables:
- Name: api_service_url
- Value: https://someapiurl.com
Below is Dockerfile. I tried to pass through ARG through CONTAINER tab CONTAINER arguments as well
In both cases echo in Dockerfile didn't receive those parameters in build log.
Container is NGINX instance with React build output. App itself is loading fine, but i am not able to pass api url to NGINX proxy_pass directive in nginx.conf file
--set-env-vars=api_service_url=https://apiserverurl is set as well, it shows in the console, but Dockerfile is not getting that value.
Here is my Dockerfile:
# build environment
FROM node:10-alpine as react-build
WORKDIR /app
COPY . ./
# server environment
FROM nginx:alpine
COPY nginx.conf /etc/nginx/conf.d/configfile.template
ENV PORT 3000
ENV HOST 0.0.0.0
ARG api_service_url
RUN echo "========api_service_url========="$api_service_url
ENV API_SERVICE_URL $api_service_url
RUN echo "========API_SERVICE_URL========="$API_SERVICE_URL
RUN sh -c "envsubst '\$PORT \$API_SERVICE_URL' < /etc/nginx/conf.d/configfile.template > /etc/nginx/conf.d/default.conf"
#RUN sh -c "envsubst < /etc/nginx/conf.d/configfile.template > /etc/nginx/conf.d/default.conf"
RUN cat /etc/nginx/conf.d/default.conf
COPY --from=react-build /app/webapp /usr/share/nginx/html
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]
How can I pass the build arg to the container?