Fixed issue with Web Docker image not getting proper environment variable substitution

As ReactJS does not seem to support reading environment variables from Docker runtime variables, we'll pull it instead from buildtime.
Also added copying of nginx config file in the Dockerfile
Modified API Dockerfile to accept WebUri for CORS, also removed duplicate setting of CORS in Program.cs
This commit is contained in:
2024-03-21 21:01:58 -05:00
parent f1144d2cb9
commit 95ddb3236c
5 changed files with 9 additions and 19 deletions

View File

@ -1,22 +1,15 @@
FROM node:17-alpine as builder
# Set the environment variables
ENV API_BASE_URL=
ENV AUTH0_DOMAIN=
ENV AUTH0_CLIENT_ID=
ENV AUTH0_CALLBACK_URL=
ENV AUTH0_AUDIENCE=
ARG REACT_APP_API_BASE_URL
ARG REACT_APP_AUTH0_DOMAIN
ARG REACT_APP_AUTH0_CLIENT_ID
ARG REACT_APP_AUTH0_CALLBACK_URL
ARG REACT_APP_AUTH0_AUDIENCE
WORKDIR /app
COPY package.json .
RUN npm install
RUN echo 'DEBUG': $API_BASE_URL
RUN echo 'DEBUG': $AUTH0_DOMAIN
RUN echo 'DEBUG': $AUTH0_CLIENT_ID
RUN echo 'DEBUG': $AUTH0_CALLBACK_URL
RUN echo 'DEBUG': $AUTH0_AUDIENCE
COPY . .
RUN npm run build
@ -24,5 +17,6 @@ FROM nginx:mainline-alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/build .
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]