18 lines
477 B
Docker
18 lines
477 B
Docker
FROM node:18-alpine AS builder
|
||
WORKDIR /app
|
||
COPY package*.json ./
|
||
RUN npm install
|
||
COPY . .
|
||
|
||
# NAS部署非常关键的一步:由于走Nginx同域反代,需将URL置空以使用相对路径,避免局域网IP锁死
|
||
ENV VITE_API_BASE_URL=""
|
||
RUN npm run build
|
||
|
||
FROM nginx:alpine
|
||
# 获取vite构件结果
|
||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||
# 覆盖Nginx默认配置
|
||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||
|
||
# 暴露的Web服务器访问端口
|
||
EXPOSE 80 |