From 146f274ec0a7f5e2ff1a89c14a424a4a429f0de9 Mon Sep 17 00:00:00 2001 From: Dan Gros Date: Wed, 17 Mar 2021 00:52:03 -0400 Subject: [PATCH] first commit - still not building --- ui/.dockerignore | 1 + ui/Dockerfile.prod | 17 +++++++++++++++++ ui/nginx/nginx.conf | 18 ++++++++++++++++++ ui/yarn.lock | 0 4 files changed, 36 insertions(+) create mode 100644 ui/.dockerignore create mode 100644 ui/Dockerfile.prod create mode 100644 ui/nginx/nginx.conf create mode 100644 ui/yarn.lock diff --git a/ui/.dockerignore b/ui/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/ui/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/ui/Dockerfile.prod b/ui/Dockerfile.prod new file mode 100644 index 0000000..a440ed3 --- /dev/null +++ b/ui/Dockerfile.prod @@ -0,0 +1,17 @@ +# stage1 - build react app first +FROM node:14.16.0-alpine3.10 as build +WORKDIR /app_ui +ENV PATH /app/node_modules/.bin:$PATH +COPY ./package.json /app_ui/ +COPY ./yarn.lock /app_ui/ +RUN yarn +COPY . /app_ui +RUN yarn build + +# stage 2 - build the final image and copy the react build files +FROM nginx:1.18.0-alpine +COPY --from=build /app_ui/build /usr/share/nginx/html +RUN rm /etc/nginx/conf.d/default.conf +COPY nginx/nginx.conf /etc/nginx/conf.d +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] diff --git a/ui/nginx/nginx.conf b/ui/nginx/nginx.conf new file mode 100644 index 0000000..b6a904e --- /dev/null +++ b/ui/nginx/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + index /index.html index.htm; + + # to redirect all the requests to index.html, useful when using react-router + + try_files $uri /index.html; + } + + error_page 500 502 503 504 /50x.html; + + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file diff --git a/ui/yarn.lock b/ui/yarn.lock new file mode 100644 index 0000000..e69de29