Files
J-Board-Lite/docker-compose.yml
2026-04-30 09:18:05 +10:00

56 lines
1.2 KiB
YAML

services:
app:
build:
context: .
target: runner
restart: unless-stopped
ports:
- "${APP_PORT:-3000}:3000"
depends_on:
redis:
condition: service_healthy
volumes:
- sqlite_data:/app/storage
env_file: .env
environment:
- DATABASE_URL=file:/app/storage/jboard.db
- REDIS_URL=redis://redis:6379
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1:3000/api/public/app-info || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# 数据库初始化:首次部署或 schema 变更时运行
# docker compose run --rm init
init:
build:
context: .
target: init
volumes:
- sqlite_data:/app/storage
env_file: .env
environment:
- DATABASE_URL=file:/app/storage/jboard.db
profiles:
- setup
redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis_data:/data
# 仅暴露给内部网络,生产环境不要对外开放
# ports:
# - "6379:6379"
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 5s
timeout: 5s
retries: 5
volumes:
sqlite_data:
redis_data: