1+ # webapp/infra/docker/docker-compose.yml
2+ services :
3+ webui :
4+ build :
5+ context : ../../
6+ dockerfile : infra/docker/Dockerfile.webui
7+ ports :
8+ - " 3000:80"
9+ environment :
10+ - VITE_APP_ENV=local
11+ depends_on :
12+ api :
13+ condition : service_started # webui depends on api for data, but api needs couchdb first
14+ networks :
15+ - gofannon-net
16+
17+ api :
18+ build :
19+ context : ../../packages/api/user-service
20+ dockerfile : ../../../infra/docker/Dockerfile.api
21+ volumes :
22+ - ../../packages/api/user-service:/app # Mount for hot-reloading
23+ ports :
24+ - " 8000:8000"
25+ environment :
26+ - APP_ENV=local
27+ - STORAGE_PROVIDER=s3
28+ - S3_ENDPOINT_URL=http://minio:9000
29+ - AWS_ACCESS_KEY_ID=minioadmin
30+ - AWS_SECRET_ACCESS_KEY=minioadmin
31+ - AWS_DEFAULT_REGION=us-east-1
32+ - DATABASE_PROVIDER=couchdb
33+ - COUCHDB_URL=http://couchdb:5984/
34+ env_file :
35+ - ./.env
36+ depends_on :
37+ minio :
38+ condition : service_started
39+ couchdb-setup :
40+ condition : service_completed_successfully
41+ networks :
42+ - gofannon-net
43+ command : uvicorn main:app --host 0.0.0.0 --port 8000 --reload
44+
45+ minio :
46+ image : minio/minio:RELEASE.2023-03-20T20-16-18Z
47+ ports :
48+ - " 9000:9000" # API port
49+ - " 9001:9001" # Console port
50+ environment :
51+ - MINIO_ROOT_USER=minioadmin
52+ - MINIO_ROOT_PASSWORD=minioadmin
53+ volumes :
54+ - minio-data:/data
55+ networks :
56+ - gofannon-net
57+ command : server /data --console-address ":9001"
58+
59+ couchdb :
60+ image : couchdb:3.3
61+ ports :
62+ - " 5984:5984"
63+ environment :
64+ - COUCHDB_USER=${COUCHDB_USER:-admin}
65+ - COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}
66+ volumes :
67+ - couchdb-data:/opt/couchdb/data
68+ networks :
69+ - gofannon-net
70+ healthcheck : # <--- ADD THIS HEALTHCHECK
71+ test : ["CMD-SHELL", "curl -f http://localhost:5984/ || exit 1"]
72+ interval : 5s
73+ timeout : 5s
74+ retries : 5
75+ start_period : 10s # Give CouchDB some time to warm up before checks begin
76+
77+ couchdb-setup : # <--- NEW SERVICE FOR COUCHDB INITIALIZATION
78+ build :
79+ context : ../../infra/docker # Use the directory where Dockerfile.couchdb-setup and couchdb-init.sh are
80+ dockerfile : Dockerfile.couchdb-setup
81+ environment :
82+ - COUCHDB_USER=${COUCHDB_USER:-admin}
83+ - COUCHDB_PASSWORD=${COUCHDB_PASSWORD:-password}
84+ - COUCHDB_URL=http://couchdb:5984/ # Use the internal service name
85+ depends_on :
86+ couchdb :
87+ condition : service_healthy # Wait for couchdb to be healthy before attempting setup
88+ networks :
89+ - gofannon-net
90+ command : /app/couchdb-init.sh # Execute the initialization script
91+
92+ networks :
93+ gofannon-net :
94+ driver : bridge
95+
96+ volumes :
97+ minio-data :
98+ couchdb-data:
0 commit comments