Add Docker deployment support
- Add Dockerfile for containerization - Add docker-compose.yml for easy deployment - Add .dockerignore to optimize build - Add .env.example for environment configuration - Add DOCKER_DEPLOY.md with comprehensive deployment guide Support for: - Local Docker deployment - Cloud platforms (Render, Railway, Fly.io, GCP, AWS) - Persistent storage configuration - Health checks and monitoring
This commit is contained in:
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
||||
# 使用官方 Node.js 运行时作为基础镜像
|
||||
FROM node:24-alpine
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 复制 package.json 和 package-lock.json
|
||||
COPY package*.json ./
|
||||
|
||||
# 安装项目依赖
|
||||
RUN npm ci --only=production
|
||||
|
||||
# 复制项目文件
|
||||
COPY . .
|
||||
|
||||
# 暴露端口(默认3000,可通过环境变量覆盖)
|
||||
EXPOSE 3000
|
||||
|
||||
# 设置环境变量
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# 启动应用
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user