From d5fecb0044b462c49e2c47e005633c83ba0b22e6 Mon Sep 17 00:00:00 2001 From: vucv Date: Thu, 6 Apr 2023 15:08:45 +0700 Subject: [PATCH] setup docker --- .nginx/nginx.conf | 16 +++++++++++++ Dockerfile | 58 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 7 ++++++ 3 files changed, 81 insertions(+) create mode 100644 .nginx/nginx.conf create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.nginx/nginx.conf b/.nginx/nginx.conf new file mode 100644 index 0000000..c6b8c36 --- /dev/null +++ b/.nginx/nginx.conf @@ -0,0 +1,16 @@ +server { + + listen 80; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri /index.html =404; + } + + 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/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2a2c258 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,58 @@ +# syntax=docker/dockerfile:1.4 + +# 1. For build React app +FROM node:lts AS development + +# Set working directory +WORKDIR /app + +# +COPY package.json /app/package.json +COPY package-lock.json /app/package-lock.json + +# Same as npm install +RUN npm ci + +COPY . /app + +ENV CI=true +ENV PORT=3003 + +CMD [ "npm", "start" ] + +FROM development AS build + +RUN npm run build + + +FROM development as dev-envs +RUN <