Can't access environment variables while deploying

Issues information

Your issue

I am not able to access environment variables at deployment time. As shown below.

Dockerfile content (if any)

WORKDIR /app
COPY package.json package.json
RUN yarn --no-lockfile
COPY . .
RUN echo $URL
RUN echo $NODE_ENV
RUN printenv
RUN yarn build
EXPOSE 1337
CMD ["yarn", "start"]

I think your environment variables injected via --build-arg when building docker image, use it as below

ARG URL
RUN echo $URL

When running as container, environment variables will be working properly

1 Like