2026-02-02 23:25:09 +08:00
|
|
|
|
name: lunafox
|
|
|
|
|
|
|
2026-01-28 15:47:46 +08:00
|
|
|
|
services:
|
|
|
|
|
|
# Agent 请通过安装脚本注册启动(/api/agents/install.sh)
|
|
|
|
|
|
postgres:
|
2026-02-01 12:52:14 +08:00
|
|
|
|
image: postgres:16.3-alpine
|
|
|
|
|
|
restart: "on-failure:3"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
environment:
|
2026-01-30 13:01:02 +08:00
|
|
|
|
POSTGRES_DB: ${DB_NAME:-lunafox}
|
2026-01-28 15:47:46 +08:00
|
|
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
|
|
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
|
|
|
|
ports:
|
|
|
|
|
|
- "${DB_PORT:-5432}:5432"
|
|
|
|
|
|
volumes:
|
|
|
|
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
|
|
healthcheck:
|
|
|
|
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
|
|
|
|
|
|
interval: 5s
|
|
|
|
|
|
timeout: 5s
|
|
|
|
|
|
retries: 5
|
|
|
|
|
|
|
|
|
|
|
|
redis:
|
2026-02-01 12:52:14 +08:00
|
|
|
|
image: redis:7.4.7-alpine
|
|
|
|
|
|
restart: "on-failure:3"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
ports:
|
|
|
|
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
|
|
|
|
healthcheck:
|
|
|
|
|
|
test: [CMD, redis-cli, ping]
|
|
|
|
|
|
interval: 5s
|
|
|
|
|
|
timeout: 5s
|
|
|
|
|
|
retries: 5
|
|
|
|
|
|
|
|
|
|
|
|
server:
|
2026-02-01 12:52:14 +08:00
|
|
|
|
image: golang:1.25.6
|
|
|
|
|
|
restart: "on-failure:3"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
env_file:
|
|
|
|
|
|
- .env
|
|
|
|
|
|
environment:
|
|
|
|
|
|
- IMAGE_TAG=${IMAGE_TAG:-dev}
|
|
|
|
|
|
- PUBLIC_URL=${PUBLIC_URL:-}
|
|
|
|
|
|
- GOMODCACHE=/go/pkg/mod
|
|
|
|
|
|
- GOCACHE=/root/.cache/go-build
|
2026-02-01 12:52:14 +08:00
|
|
|
|
- GO111MODULE=${GO111MODULE:-on}
|
|
|
|
|
|
- GOPROXY=${GOPROXY:-https://goproxy.cn,direct}
|
2026-01-28 15:47:46 +08:00
|
|
|
|
ports:
|
|
|
|
|
|
- "8080:8080"
|
|
|
|
|
|
working_dir: /workspace/server
|
|
|
|
|
|
command: sh -c "go install github.com/air-verse/air@latest && air -c .air.toml"
|
|
|
|
|
|
depends_on:
|
|
|
|
|
|
postgres:
|
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
|
redis:
|
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
|
volumes:
|
2026-01-30 13:01:02 +08:00
|
|
|
|
- /opt/lunafox:/opt/lunafox
|
2026-01-28 15:47:46 +08:00
|
|
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
|
|
|
|
- ../server:/workspace/server
|
|
|
|
|
|
- go-mod-cache:/go/pkg/mod
|
|
|
|
|
|
- go-build-cache:/root/.cache/go-build
|
|
|
|
|
|
|
|
|
|
|
|
frontend:
|
2026-02-01 12:52:14 +08:00
|
|
|
|
image: node:20.20.0-alpine
|
|
|
|
|
|
restart: "on-failure:3"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
environment:
|
|
|
|
|
|
- NODE_ENV=development
|
|
|
|
|
|
- API_HOST=server
|
|
|
|
|
|
- NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL:-}
|
|
|
|
|
|
- PORT=3000
|
|
|
|
|
|
- HOSTNAME=0.0.0.0
|
2026-02-01 12:52:14 +08:00
|
|
|
|
ports:
|
|
|
|
|
|
- "3000:3000"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
working_dir: /app
|
2026-02-01 12:52:14 +08:00
|
|
|
|
command: sh -c "corepack enable && corepack prepare pnpm@latest --activate && if [ ! -d node_modules/.pnpm ]; then pnpm install; fi && pnpm dev"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
depends_on:
|
|
|
|
|
|
server:
|
|
|
|
|
|
condition: service_started
|
|
|
|
|
|
volumes:
|
|
|
|
|
|
- ../frontend:/app
|
|
|
|
|
|
- frontend_node_modules:/app/node_modules
|
|
|
|
|
|
- frontend_pnpm_store:/root/.local/share/pnpm/store
|
2026-02-01 12:52:14 +08:00
|
|
|
|
healthcheck:
|
|
|
|
|
|
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000',res=>process.exit(res.statusCode<500?0:1)).on('error',()=>process.exit(1))"]
|
|
|
|
|
|
interval: 5s
|
|
|
|
|
|
timeout: 5s
|
|
|
|
|
|
retries: 20
|
|
|
|
|
|
start_period: 20s
|
2026-01-28 15:47:46 +08:00
|
|
|
|
|
|
|
|
|
|
nginx:
|
|
|
|
|
|
build:
|
|
|
|
|
|
context: ..
|
|
|
|
|
|
dockerfile: docker/nginx/Dockerfile
|
2026-01-30 13:01:02 +08:00
|
|
|
|
image: yyhuni/lunafox-nginx:${IMAGE_TAG:-dev}
|
2026-02-01 12:52:14 +08:00
|
|
|
|
restart: "on-failure:3"
|
2026-01-28 15:47:46 +08:00
|
|
|
|
depends_on:
|
|
|
|
|
|
server:
|
|
|
|
|
|
condition: service_started
|
|
|
|
|
|
frontend:
|
2026-02-01 12:52:14 +08:00
|
|
|
|
condition: service_healthy
|
2026-01-28 15:47:46 +08:00
|
|
|
|
ports:
|
|
|
|
|
|
- "8083:8083"
|
|
|
|
|
|
volumes:
|
|
|
|
|
|
- ./nginx/ssl:/etc/nginx/ssl:ro
|
|
|
|
|
|
|
|
|
|
|
|
# Worker: build image for task execution (not run in dev by default).
|
|
|
|
|
|
worker:
|
|
|
|
|
|
build:
|
2026-02-01 12:52:14 +08:00
|
|
|
|
context: ../worker
|
|
|
|
|
|
dockerfile: Dockerfile
|
2026-01-30 13:01:02 +08:00
|
|
|
|
image: yyhuni/lunafox-worker:${IMAGE_TAG:-dev}
|
2026-01-28 15:47:46 +08:00
|
|
|
|
restart: "no"
|
|
|
|
|
|
volumes:
|
2026-01-30 13:01:02 +08:00
|
|
|
|
- /opt/lunafox:/opt/lunafox
|
2026-01-28 15:47:46 +08:00
|
|
|
|
command: echo "Worker image built for development"
|
|
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
|
postgres_data:
|
|
|
|
|
|
go-mod-cache:
|
|
|
|
|
|
go-build-cache:
|
|
|
|
|
|
frontend_node_modules:
|
|
|
|
|
|
frontend_pnpm_store:
|
|
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
|
default:
|
2026-01-30 13:01:02 +08:00
|
|
|
|
name: lunafox_network # Fixed network name, independent of directory name
|