add react-nginx

Signed-off-by: phamthainb <phamthai4643@gmail.com>
This commit is contained in:
phamthainb
2021-03-29 13:26:09 +07:00
parent a3c3882227
commit 61b0edf2ca
22 changed files with 11808 additions and 0 deletions

26
react-nginx/Dockerfile Executable file
View File

@@ -0,0 +1,26 @@
# 1. For build React app
FROM node:10 AS builder
# Set working directory
WORKDIR /app
# Copy all files from current directory to working dir in image
COPY . .
# install all package and build project
RUN npm install && npm run build
# 2. For Nginx setup
FROM nginx:alpine
# Copy config nginx
COPY --from=builder /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf
WORKDIR /usr/share/nginx/html
# Remove default nginx static assets
RUN rm -rf ./*
# Copy static assets from builder stage
COPY --from=builder /app/build .
# Containers run nginx with global directives and daemon off
ENTRYPOINT ["nginx", "-g", "daemon off;"]