update fir review and try fix audit
Signed-off-by: phamthainb <phamthai4643@gmail.com>
This commit is contained in:
parent
64c18cc957
commit
d13268af81
1
react-nginx/.gitignore
vendored
1
react-nginx/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
build
|
@ -1,17 +1,32 @@
|
|||||||
# 1. For build React app
|
# 1. For build React app
|
||||||
FROM node:10 AS builder
|
FROM node:lts AS development
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
# Copy all files from current directory to working dir in image
|
|
||||||
COPY . .
|
#
|
||||||
# install all package and build project
|
COPY package.json /app/package.json
|
||||||
RUN npm install && npm run build
|
COPY package-lock.json /app/package-lock.json
|
||||||
|
|
||||||
|
# Same as npm install
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
|
||||||
|
ENV CI=true
|
||||||
|
ENV PORT=3000
|
||||||
|
|
||||||
|
CMD [ "npm", "start" ]
|
||||||
|
|
||||||
|
FROM development AS build
|
||||||
|
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
# 2. For Nginx setup
|
# 2. For Nginx setup
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# Copy config nginx
|
# Copy config nginx
|
||||||
COPY --from=builder /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY --from=build /app/.nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
WORKDIR /usr/share/nginx/html
|
WORKDIR /usr/share/nginx/html
|
||||||
|
|
||||||
@ -19,7 +34,7 @@ WORKDIR /usr/share/nginx/html
|
|||||||
RUN rm -rf ./*
|
RUN rm -rf ./*
|
||||||
|
|
||||||
# Copy static assets from builder stage
|
# Copy static assets from builder stage
|
||||||
COPY --from=builder /app/build .
|
COPY --from=build /app/build .
|
||||||
|
|
||||||
# Containers run nginx with global directives and daemon off
|
# Containers run nginx with global directives and daemon off
|
||||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
version: "2"
|
version: "3.7"
|
||||||
services:
|
services:
|
||||||
frontend:
|
frontend:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
container_name: frontend
|
container_name: frontend
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "3000:80"
|
||||||
|
35997
react-nginx/package-lock.json
generated
Normal file
35997
react-nginx/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
"react": "^17.0.1",
|
"react": "^17.0.1",
|
||||||
"react-dom": "^17.0.1",
|
"react-dom": "^17.0.1",
|
||||||
"react-scripts": "4.0.3",
|
"react-scripts": "^4.0.3",
|
||||||
"web-vitals": "^1.0.1"
|
"web-vitals": "^1.0.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
11398
react-nginx/yarn.lock
11398
react-nginx/yarn.lock
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user