|
| 1 | +# ───────────────────────────────────────────────────────────────────────────── |
| 2 | +# CrewForm — Docker Compose (Self-Hosting) |
| 3 | +# ───────────────────────────────────────────────────────────────────────────── |
| 4 | +# |
| 5 | +# Usage: |
| 6 | +# cp .env.example .env # edit with your values |
| 7 | +# docker compose up -d |
| 8 | +# |
| 9 | +# Services: |
| 10 | +# postgres — PostgreSQL 15 with persistent volume |
| 11 | +# migrate — Runs all SQL migrations, then exits |
| 12 | +# frontend — Vite build served via nginx (port 3000) |
| 13 | +# task-runner — Node.js polling service |
| 14 | +# ───────────────────────────────────────────────────────────────────────────── |
| 15 | + |
| 16 | +services: |
| 17 | + # ── PostgreSQL ────────────────────────────────────────────────────────── |
| 18 | + postgres: |
| 19 | + image: postgres:15-alpine |
| 20 | + restart: unless-stopped |
| 21 | + environment: |
| 22 | + POSTGRES_DB: ${POSTGRES_DB:-crewform} |
| 23 | + POSTGRES_USER: ${POSTGRES_USER:-crewform} |
| 24 | + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} |
| 25 | + ports: |
| 26 | + - "${POSTGRES_PORT:-5432}:5432" |
| 27 | + volumes: |
| 28 | + - pgdata:/var/lib/postgresql/data |
| 29 | + healthcheck: |
| 30 | + test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-crewform}" ] |
| 31 | + interval: 5s |
| 32 | + timeout: 5s |
| 33 | + retries: 10 |
| 34 | + |
| 35 | + # ── Migrations ────────────────────────────────────────────────────────── |
| 36 | + migrate: |
| 37 | + image: postgres:15-alpine |
| 38 | + depends_on: |
| 39 | + postgres: |
| 40 | + condition: service_healthy |
| 41 | + environment: |
| 42 | + PGHOST: postgres |
| 43 | + PGPORT: "5432" |
| 44 | + PGDATABASE: ${POSTGRES_DB:-crewform} |
| 45 | + PGUSER: ${POSTGRES_USER:-crewform} |
| 46 | + PGPASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env} |
| 47 | + volumes: |
| 48 | + - ./supabase/migrations:/migrations:ro |
| 49 | + - ./docker/migrate.sh:/migrate.sh:ro |
| 50 | + entrypoint: [ "sh", "/migrate.sh" ] |
| 51 | + |
| 52 | + # ── Frontend ──────────────────────────────────────────────────────────── |
| 53 | + frontend: |
| 54 | + build: |
| 55 | + context: . |
| 56 | + dockerfile: Dockerfile |
| 57 | + args: |
| 58 | + VITE_SUPABASE_URL: ${VITE_SUPABASE_URL:-http://localhost:8000} |
| 59 | + VITE_SUPABASE_ANON_KEY: ${VITE_SUPABASE_ANON_KEY:-} |
| 60 | + VITE_APP_URL: ${VITE_APP_URL:-http://localhost:3000} |
| 61 | + restart: unless-stopped |
| 62 | + ports: |
| 63 | + - "${FRONTEND_PORT:-3000}:80" |
| 64 | + depends_on: |
| 65 | + migrate: |
| 66 | + condition: service_completed_successfully |
| 67 | + |
| 68 | + # ── Task Runner ───────────────────────────────────────────────────────── |
| 69 | + task-runner: |
| 70 | + build: |
| 71 | + context: ./task-runner |
| 72 | + dockerfile: Dockerfile |
| 73 | + restart: unless-stopped |
| 74 | + environment: |
| 75 | + VITE_SUPABASE_URL: ${VITE_SUPABASE_URL:-http://localhost:8000} |
| 76 | + SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY:-} |
| 77 | + ENCRYPTION_KEY: ${ENCRYPTION_KEY:-} |
| 78 | + OPENAI_API_KEY: ${OPENAI_API_KEY:-} |
| 79 | + ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY:-} |
| 80 | + GOOGLE_GENERATIVE_AI_API_KEY: ${GOOGLE_GENERATIVE_AI_API_KEY:-} |
| 81 | + depends_on: |
| 82 | + migrate: |
| 83 | + condition: service_completed_successfully |
| 84 | + |
| 85 | +volumes: |
| 86 | + pgdata: |
0 commit comments