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
22 lines
492 B
Docker
22 lines
492 B
Docker
FROM node:17-alpine as builder
|
|
|
|
# Set the environment variables
|
|
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
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
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;"] |