Files
xingrin/docker/docker-compose.dev.yml
2026-01-30 13:01:02 +08:00

114 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
# Agent 请通过安装脚本注册启动(/api/agents/install.sh
postgres:
image: postgres:16-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-lunafox}
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:
image: redis:7-alpine
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
healthcheck:
test: [CMD, redis-cli, ping]
interval: 5s
timeout: 5s
retries: 5
server:
image: golang:1.24
restart: unless-stopped
env_file:
- .env
environment:
- IMAGE_TAG=${IMAGE_TAG:-dev}
- PUBLIC_URL=${PUBLIC_URL:-}
- GOMODCACHE=/go/pkg/mod
- GOCACHE=/root/.cache/go-build
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:
- /opt/lunafox:/opt/lunafox
- /var/run/docker.sock:/var/run/docker.sock
- ../server:/workspace/server
- ../VERSION:/workspace/server/VERSION:ro
- go-mod-cache:/go/pkg/mod
- go-build-cache:/root/.cache/go-build
frontend:
image: node:20-alpine
restart: unless-stopped
environment:
- NODE_ENV=development
- API_HOST=server
- NEXT_PUBLIC_BACKEND_URL=${NEXT_PUBLIC_BACKEND_URL:-}
- PORT=3000
- HOSTNAME=0.0.0.0
working_dir: /app
command: sh -c "corepack enable && corepack prepare pnpm@latest --activate && pnpm install && pnpm dev"
depends_on:
server:
condition: service_started
volumes:
- ../frontend:/app
- frontend_node_modules:/app/node_modules
- frontend_pnpm_store:/root/.local/share/pnpm/store
nginx:
build:
context: ..
dockerfile: docker/nginx/Dockerfile
image: yyhuni/lunafox-nginx:${IMAGE_TAG:-dev}
restart: unless-stopped
depends_on:
server:
condition: service_started
frontend:
condition: service_started
ports:
- "8083:8083"
volumes:
- ./nginx/ssl:/etc/nginx/ssl:ro
# Worker: build image for task execution (not run in dev by default).
worker:
build:
context: ..
dockerfile: worker/Dockerfile
image: yyhuni/lunafox-worker:${IMAGE_TAG:-dev}
restart: "no"
volumes:
- /opt/lunafox:/opt/lunafox
command: echo "Worker image built for development"
volumes:
postgres_data:
go-mod-cache:
go-build-cache:
frontend_node_modules:
frontend_pnpm_store:
networks:
default:
name: lunafox_network # Fixed network name, independent of directory name