添加docker镜像等服务
This commit is contained in:
41
docker-compose.yml
Normal file
41
docker-compose.yml
Normal file
@@ -0,0 +1,41 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- DATABASE_URL=file:/app/data/database.db
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# 开发环境(可选的开发容器)
|
||||
app-dev:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.simple
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "5173:5173" # Vite开发服务器端口
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DATABASE_URL=file:/app/data/database.db
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- .:/app
|
||||
- /app/node_modules
|
||||
- /app/frontend/node_modules
|
||||
command: npm run dev
|
||||
profiles:
|
||||
- dev
|
||||
Reference in New Issue
Block a user