Files
PicAnalysis/frontend/Dockerfile
congsh ecf3999d2a fix: 修复Docker构建和路径解析问题
- 在Dockerfile中使用npm中国镜像加速依赖安装
- 修正后端健康检查端点路径
- 修复Docker环境中图片路径解析问题
- 修正前端API地址默认值
2026-02-27 22:42:53 +08:00

44 lines
990 B
Docker

# ========================================
# Stage 1: Dependencies
# ========================================
FROM node:20-alpine AS deps
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies with Chinese mirror
RUN npm config set registry https://registry.npmmirror.com && \
npm ci
# ========================================
# Stage 2: Builder
# ========================================
FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Build the application (skip type check for production)
RUN npx vite build
# ========================================
# Stage 3: Runner with Nginx
# ========================================
FROM nginx:alpine AS runner
# Copy built assets from builder
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy custom nginx config
COPY nginx.docker.conf /etc/nginx/conf.d/default.conf
# Expose port
EXPOSE 80
# Start nginx
CMD ["nginx", "-g", "daemon off;"]