From 8b4cb4e21e3845340de0eb6f08c51c3cde217397 Mon Sep 17 00:00:00 2001 From: earndt <earndt@USA-MAC-NIS1172.local> Date: Tue, 11 May 2021 14:33:12 -0700 Subject: [PATCH] [AFP-108] :construction_worker: Makes changes to Dockerfile for Azure deployment [@earndt] --- Dockerfile | 32 +++++++++++++++++++++++--------- nginx/nginx.conf | 32 +++++++++++++++++++++----------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1927b5c..aa77b91 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,29 @@ -FROM node:13.12.0-alpine as build +FROM node:14.16-alpine3.13 as build WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH -COPY package.json ./ -COPY package-lock.json ./ -RUN npm ci -RUN npm install react-scripts@3.4.1 -g -COPY . ./ -RUN npm run build +COPY . . +RUN yarn +RUN yarn build FROM nginx:stable-alpine COPY --from=build /app/build /usr/share/nginx/html -COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=build /app/nginx/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +CMD ["nginx", "-g", "daemon off;"] + +####BELOW IS FOR TESTING ONLY, DO NOT UNCOMMENT +#FROM node:13.12.0-alpine as build +#WORKDIR /app +#ENV PATH /app/node_modules/.bin:$PATH +#COPY package.json ./ +#COPY package-lock.json ./ +#RUN npm ci +#RUN npm install react-scripts@3.4.1 -g +#COPY . ./ +#RUN npm run build + +#FROM nginx:stable-alpine +#COPY --from=build /app/build /usr/share/nginx/html +#COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf +#EXPOSE 80 +#CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 758a646..5b06083 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -1,17 +1,27 @@ + server { +listen 80; +location / { +root /usr/share/nginx/html; +index index.html index.htm; +try_files $uri $uri/ /index.html =404; +} +} - listen 80; +# server { +# +# listen 80; - location / { - root /usr/share/nginx/html; - index index.html index.htm; - try_files $uri $uri/ /index.html; - } +# location / { +# root /usr/share/nginx/html; +# index index.html index.htm; +# try_files $uri $uri/ /index.html; +# } - error_page 500 502 503 504 /50x.html; +# error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } +# location = /50x.html { +# root /usr/share/nginx/html; +# } -} \ No newline at end of file +# } \ No newline at end of file -- 2.18.1