Files
vstats/docker-compose.example.yml
zsai001 9b1051d7d9 feat: 添加 Docker 支持和端口配置
- 添加 Dockerfile 和 docker-compose 配置文件
- 支持从配置文件读取端口(优先级:配置 > 环境变量 > 默认值)
- 添加 Docker Hub 自动构建和推送
- 更新 README 添加 Docker 一键部署说明
- 添加环境变量支持配置和数据库路径
2025-12-04 21:39:16 +08:00

51 lines
1.4 KiB
YAML

version: '3.8'
# Example docker-compose configuration
# Copy this file to docker-compose.yml and customize as needed
services:
vstats-server:
build:
context: .
dockerfile: Dockerfile
container_name: vstats-server
restart: unless-stopped
ports:
# Map host port to container port
# Format: "HOST_PORT:CONTAINER_PORT"
# Example: "3001:3001" or "8080:3001" to access via host port 8080
- "3001:3001"
environment:
# Port can be set via environment variable (overridden by config file)
- VSTATS_PORT=3001
# Web directory is set automatically, but can be overridden
- VSTATS_WEB_DIR=/app/web/dist
volumes:
# Persistent data directory (config and database)
# This ensures data persists across container restarts
- ./data:/app/data
# Optional: Mount a custom config file
# Uncomment the line below and provide your config file path
# - ./vstats-config.json:/app/data/vstats-config.json:ro
# Optional: Mount only the database for backup purposes
# - ./data/vstats.db:/app/data/vstats.db
working_dir: /app/data
# Resource limits (optional)
# deploy:
# resources:
# limits:
# cpus: '1'
# memory: 512M
# reservations:
# cpus: '0.5'
# memory: 256M
networks:
- vstats-network
networks:
vstats-network:
driver: bridge