2023-12-06 05:41:45 +00:00
|
|
|
# 构建应用
|
|
|
|
FROM node:18 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
|
|
RUN npm install
|
|
|
|
COPY . .
|
2024-04-24 02:36:23 +00:00
|
|
|
RUN [ ! -e ".env" ] && cp .env.example .env || true
|
2023-12-06 05:41:45 +00: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"]
|