services: # Main OpenCodeHub application app: build: context: . dockerfile: Dockerfile container_name: opencodehub restart: unless-stopped ports: - "4321:4321" # Web interface environment: - NODE_ENV=production - DATABASE_URL=postgresql://opencodehub:opencodehub@postgres:5432/opencodehub - DATABASE_TYPE=postgres - REDIS_URL=redis://redis:6379 - JWT_SECRET=${JWT_SECRET:-supersecretjwtkey} - WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef} - INTERNAL_HOOK_SECRET=${INTERNAL_HOOK_SECRET:-supersecrethookkey} - CRON_SECRET=${CRON_SECRET:-supersecretcronkey} - RUNNER_SECRET=${RUNNER_SECRET:-supersecretrunnerkey} - AI_CONFIG_ENCRYPTION_KEY=${AI_CONFIG_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef} - SERVER_URL=http://localhost:4321 - DATA_DIR=/data - STORAGE_TYPE=local - GIT_REPOS_PATH=/data/repositories - GIT_SSH_PORT=2222 volumes: - ./data/opencodehub:/data depends_on: postgres: condition: service_healthy redis: condition: service_healthy networks: - opencodehub-network healthcheck: test: [ "CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4321/api/health", ] interval: 30s timeout: 10s retries: 3 start_period: 10s # SSH Git server ssh-git: build: context: . dockerfile: Dockerfile container_name: opencodehub-ssh restart: unless-stopped command: ["bun", "scripts/ssh-server.ts"] ports: - "2222:2222" # SSH Git environment: - NODE_ENV=production - DATABASE_URL=postgresql://opencodehub:opencodehub@postgres:5432/opencodehub - DATABASE_TYPE=postgres - REDIS_URL=redis://redis:6379 - JWT_SECRET=${JWT_SECRET:-supersecretjwtkey} - WORKFLOW_SECRET_ENCRYPTION_KEY=${WORKFLOW_SECRET_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef} - AI_CONFIG_ENCRYPTION_KEY=${AI_CONFIG_ENCRYPTION_KEY:-0123456789abcdef0123456789abcdef} - SERVER_URL=http://app:4321 - DATA_DIR=/data - STORAGE_TYPE=local - GIT_REPOS_PATH=/data/repositories - GIT_SSH_PORT=2222 - GIT_SSH_HOST_KEY=/data/ssh/host_key volumes: - ./data/opencodehub:/data depends_on: postgres: condition: service_healthy redis: condition: service_healthy networks: - opencodehub-network # PostgreSQL database postgres: image: docker.io/library/postgres:16-alpine container_name: opencodehub-postgres restart: unless-stopped environment: POSTGRES_USER: opencodehub POSTGRES_PASSWORD: opencodehub POSTGRES_DB: opencodehub volumes: - ./data/postgres:/var/lib/postgresql/data ports: - "5432:5432" networks: - opencodehub-network healthcheck: test: ["CMD-SHELL", "pg_isready -U opencodehub -d opencodehub"] interval: 10s timeout: 5s retries: 5 # Redis for caching and sessions redis: image: docker.io/library/redis:7-alpine container_name: opencodehub-redis restart: unless-stopped command: redis-server --appendonly yes volumes: - ./data/redis:/data ports: - "6379:6379" networks: - opencodehub-network healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 # Pipeline runner (for CI/CD jobs) runner: build: context: . dockerfile: Dockerfile.runner container_name: opencodehub-runner restart: unless-stopped privileged: true # Required for Docker-in-Docker environment: - RUNNER_TOKEN=${RUNNER_TOKEN:-} - SERVER_URL=http://app:4321 - DOCKER_HOST=unix:///var/run/docker.sock volumes: - /var/run/docker.sock:/var/run/docker.sock - ./data/runner/work:/work - ./data/runner/cache:/cache depends_on: - app networks: - opencodehub-network networks: opencodehub-network: driver: bridge