76 lines
1.8 KiB
YAML
76 lines
1.8 KiB
YAML
|
|
version: '3.8'
|
||
|
|
|
||
|
|
services:
|
||
|
|
postgres:
|
||
|
|
image: postgres:15-alpine
|
||
|
|
container_name: satu-peta-postgres
|
||
|
|
restart: unless-stopped
|
||
|
|
environment:
|
||
|
|
POSTGRES_USER: postgres
|
||
|
|
POSTGRES_PASSWORD: postgres
|
||
|
|
POSTGRES_DB: satupeta
|
||
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
||
|
|
ports:
|
||
|
|
- "5432:5432"
|
||
|
|
volumes:
|
||
|
|
- ./data/postgres:/var/lib/postgresql/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
minio:
|
||
|
|
image: minio/minio:latest
|
||
|
|
container_name: satu-peta-minio
|
||
|
|
restart: unless-stopped
|
||
|
|
command: server /data --console-address ":9001"
|
||
|
|
environment:
|
||
|
|
MINIO_ROOT_USER: minioadmin
|
||
|
|
MINIO_ROOT_PASSWORD: minioadmin123
|
||
|
|
ports:
|
||
|
|
- "9000:9000"
|
||
|
|
- "9001:9001"
|
||
|
|
volumes:
|
||
|
|
- minio_data:/data
|
||
|
|
healthcheck:
|
||
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||
|
|
interval: 10s
|
||
|
|
timeout: 5s
|
||
|
|
retries: 5
|
||
|
|
|
||
|
|
migration:
|
||
|
|
build:
|
||
|
|
context: .
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: satu-peta-migration
|
||
|
|
env_file:
|
||
|
|
- environment.env
|
||
|
|
command: sh -c "alembic current | grep -q '(head)' && echo 'Database already migrated' || alembic upgrade head"
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
restart: "no"
|
||
|
|
|
||
|
|
api:
|
||
|
|
build:
|
||
|
|
context: .
|
||
|
|
dockerfile: Dockerfile
|
||
|
|
container_name: satu-peta-api
|
||
|
|
restart: unless-stopped
|
||
|
|
ports:
|
||
|
|
- "5000:5000"
|
||
|
|
env_file:
|
||
|
|
- environment.env
|
||
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 5000 --reload
|
||
|
|
depends_on:
|
||
|
|
postgres:
|
||
|
|
condition: service_healthy
|
||
|
|
minio:
|
||
|
|
condition: service_healthy
|
||
|
|
migration:
|
||
|
|
condition: service_completed_successfully
|
||
|
|
|
||
|
|
volumes:
|
||
|
|
minio_data:
|