File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed
Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ node_modules
2+ .env
3+ coverage
4+ build
5+ README.md
Original file line number Diff line number Diff line change 1+ # Sử dụng một image node chính thức làm base image
2+ FROM node:16-alpine as build
3+
4+ # Thiết lập thư mục làm việc
5+ WORKDIR /app
6+
7+ # Copy package.json và package-lock.json
8+ COPY package*.json ./
9+
10+ # Cài đặt các dependencies
11+ RUN npm install
12+
13+ # Copy toàn bộ mã nguồn ứng dụng
14+ COPY . .
15+
16+ # Build ứng dụng
17+ RUN npm run build
18+
19+ # Sử dụng một image nginx chính thức để phục vụ build
20+ FROM nginx:alpine
21+
22+ # Copy build từ giai đoạn trước vào thư mục phục vụ của nginx
23+ COPY --from=build /app/build /usr/share/nginx/html
24+
25+ # Copy file cấu hình nginx
26+ COPY nginx.conf /etc/nginx/conf.d/default.conf
27+
28+ # Expose cổng 80 để có thể truy cập vào container
29+ EXPOSE 80
30+
31+ # Lệnh chạy nginx
32+ CMD ["nginx" , "-g" , "daemon off;" ]
Original file line number Diff line number Diff line change 1+ server {
2+ listen 80 ;
3+
4+ server_name localhost;
5+
6+ root /usr/share/nginx/html;
7+ index index .html index .htm;
8+
9+ location / {
10+ try_files $uri $uri / /index .html;
11+ }
12+
13+ error_page 500 502 503 504 /50x .html;
14+ location = /50x .html {
15+ root /usr/share/nginx/html;
16+ }
17+ }
You can’t perform that action at this time.
0 commit comments