fix: correct frontend Dockerfile path for vite build
This commit is contained in:
@@ -1,25 +1,26 @@
|
|||||||
# 医院绩效考核系统 - 前端 Dockerfile
|
# 医院绩效考核系统 - 前端 Dockerfile
|
||||||
FROM node:18-alpine AS builder
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app/frontend
|
||||||
|
|
||||||
# 复制 package 文件
|
# 复制 package 文件
|
||||||
COPY frontend/package*.json ./
|
COPY frontend/package*.json ./frontend/
|
||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
RUN npm install --production
|
RUN npm install
|
||||||
|
|
||||||
# 复制源代码
|
# 复制源代码
|
||||||
COPY frontend/ ./
|
COPY frontend/ ./frontend/
|
||||||
|
|
||||||
# 构建前端
|
# 构建前端
|
||||||
RUN npm run build
|
WORKDIR /app
|
||||||
|
RUN cd frontend && npm run build
|
||||||
|
|
||||||
# 生产阶段:使用 Nginx
|
# 生产阶段:使用 Nginx
|
||||||
FROM nginx:alpine
|
FROM nginx:alpine
|
||||||
|
|
||||||
# 复制构建产物
|
# 复制构建产物
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/frontend/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# 复制 Nginx 配置
|
# 复制 Nginx 配置
|
||||||
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user