This commit is contained in:
Mackie 2026-06-07 23:31:36 +08:00
parent 1e90e699d7
commit b70dca95f9
2 changed files with 16 additions and 2 deletions

View file

@ -1,13 +1,15 @@
# Stage 1: Build
FROM node:20-alpine AS builder
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install
COPY . .
RUN pnpm run build
# Stage 2: Serve
# Stage 2: Serve
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

12
nginx.conf Normal file
View file

@ -0,0 +1,12 @@
server {
listen 3000;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
gzip on;
gzip_types text/css application/javascript application/json;
}