Files
vue-driven-cloud-storage/backend/Dockerfile
2026-07-27 13:24:28 +08:00

28 lines
644 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM node:20-alpine AS dependencies
WORKDIR /app
# 原生依赖使用镜像内置 Node headers避免构建时依赖外部 headers 下载站点。
RUN apk add --no-cache python3 make g++
ENV npm_config_nodedir=/usr/local
COPY package*.json ./
RUN npm ci --omit=dev
FROM node:20-alpine AS runtime
WORKDIR /app
RUN apk add --no-cache libstdc++ wget
COPY --from=dependencies /app/node_modules ./node_modules
COPY . .
RUN mkdir -p /app/data /app/storage
EXPOSE 40001
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD wget --spider -q http://localhost:40001/api/health || exit 1
CMD ["node", "server.js"]