feat: Add Docker deployment support

- Updated Dockerfile to use npm instead of pnpm
- Added .dockerignore for optimized builds
- Created docker-compose.yml for easy deployment
- Added comprehensive Docker deployment guide
- Configured health checks and data persistence
- Ready for containerized deployment
This commit is contained in:
patdelphi
2025-08-22 16:10:58 +08:00
parent 851a9fd7e6
commit 954b37fe7a
4 changed files with 488 additions and 8 deletions

31
docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
version: '3.8'
services:
suanming-app:
build:
context: .
dockerfile: Dockerfile
ports:
- "8000:8000"
environment:
- NODE_ENV=production
- PORT=8000
- JWT_SECRET=${JWT_SECRET:-your-super-secret-jwt-key-change-this-in-production}
volumes:
# 持久化数据库文件
- suanming-data:/app/data
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8000/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
volumes:
suanming-data:
driver: local
networks:
default:
name: suanming-network