Khoi tao du an tap the duc

This commit is contained in:
phuongtc
2026-04-04 10:52:18 +07:00
commit aac648d98d
22 changed files with 3950 additions and 0 deletions

31
Dockerfile Normal file
View File

@@ -0,0 +1,31 @@
# ==========================================
# Giai đoạn 1: Build source code bằng Node.js
# ==========================================
FROM node:20-alpine AS builder
WORKDIR /app
# Copy các file cấu hình package để tận dụng Docker Cache
COPY package*.json ./
RUN npm install
# Copy toàn bộ mã nguồn và thực hiện build
COPY . .
RUN npm run build
# ==========================================
# Giai đoạn 2: Phục vụ file tĩnh bằng Nginx
# ==========================================
FROM nginx:alpine
# Xóa trang HTML mặc định của Nginx
RUN rm -rf /usr/share/nginx/html/*
# Copy thư mục dist từ Giai đoạn 1 sang thư mục html của Nginx
COPY --from=builder /app/dist /usr/share/nginx/html
# Expose port 80 (Mặc định của Nginx)
EXPOSE 80
# Chạy Nginx ở foreground
CMD ["nginx", "-g", "daemon off;"]