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:
@ -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;"]
|
||||
9
Web/nginx.conf
Normal file
9
Web/nginx.conf
Normal file
@ -0,0 +1,9 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user