- 添加Dockerfile.dev用于开发环境 - 重构主Dockerfile使用多阶段构建 - 添加nginx配置和entrypoint脚本 - 更新docker-compose.yml配置 - 修改API基础路径为相对路径 - 更新vite配置支持环境变量
26 lines
398 B
Docker
26 lines
398 B
Docker
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
|
|
RUN npm run build
|
|
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
COPY nginx.conf.template /etc/nginx/templates/nginx.conf.template
|
|
|
|
COPY entrypoint.sh /docker-entrypoint.sh
|
|
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["/docker-entrypoint.sh"]
|