Files
baby-tracker/Dockerfile
T

19 lines
415 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:22-alpine
WORKDIR /app
# 拷贝项目文件(包含宿主机提前安装好的 node_modules)
COPY . .
# 如果宿主机尚未预装 node_modules,则在镜像内进行兜底安装
RUN if [ ! -d "node_modules" ] || [ -z "$(ls -A node_modules 2>/dev/null)" ]; then \
npm install --omit=dev --no-audit; \
fi
EXPOSE 9898
ENV PORT=9898
ENV NODE_ENV=production
CMD ["node", "server/app.js"]