home/Dockerfile

17 lines
345 B
Docker
Raw Normal View History

2023-12-06 13:41:45 +08:00
# 构建应用
FROM node:18 AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
2024-04-24 10:36:23 +08:00
RUN [ ! -e ".env" ] && cp .env.example .env || true
2023-12-06 13:41:45 +08:00
RUN npm run build
# 最小化镜像
FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/dist ./dist
RUN npm install -g http-server
EXPOSE 12445
CMD ["http-server", "dist", "-p", "12445"]