automated_api/Dockerfile
lixin e094de8dc0
Some checks failed
continuous-integration/drone/push Build is failing
refactor(dockerfile): Optimize Docker build process for better flexibility
- Conditionally copy package.json without assuming pnpm-lock.yaml presence
- Add explicit step to install pnpm globally
- Simplify source code copying and dependency installation
- Maintain compatibility with Node.js 18 alpine image
2025-01-25 10:52:21 +08:00

17 lines
266 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:18-alpine
WORKDIR /app
# 只复制 package.json因为可能没有 pnpm-lock.yaml
COPY package.json ./
# 复制所有源代码
COPY . .
# 安装 pnpm 并初始化项目
RUN npm install -g pnpm && \
pnpm install
EXPOSE 8001
CMD ["pnpm", "start"]