Files
stock/frontend/Dockerfile
T

21 lines
434 B
Docker

# 前端构建
ARG NODE_IMAGE=node:20-alpine
FROM ${NODE_IMAGE} AS builder
WORKDIR /build
COPY package.json package-lock.json* ./
RUN npm install
COPY . ./
RUN npm run build
# 使用 nginx 提供静态资源
FROM nginx:1.29.0-alpine
RUN apk add --no-cache tzdata
ENV TZ=Asia/Shanghai
COPY --from=builder /build/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]