docker-compose.yml•2.3 kB
services:
# PostgreSQL service for async database operations
postgres:
image: postgres:15-alpine
container_name: antifragile_postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-postgres}
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
# Add a volume for initialization scripts
- ./docker/postgres/init:/docker-entrypoint-initdb.d
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
interval: 5s
timeout: 5s
retries: 5
networks:
- antifragile_network
restart: unless-stopped
# Streamlit service for frontend
streamlit:
build:
context: .
dockerfile: docker/streamlit.Dockerfile
container_name: antifragile_streamlit
depends_on:
postgres:
condition: service_healthy
environment:
APP_ENV: ${APP_ENV:-development}
DATABASE_URL: ${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/postgres}
STREAMLIT_DEPLOYMENT: ${STREAMLIT_DEPLOYMENT:-local}
# Streamlit server settings
STREAMLIT_SERVER_PORT: 8501
STREAMLIT_SERVER_ADDRESS: 0.0.0.0
STREAMLIT_SERVER_HEADLESS: true
STREAMLIT_SERVER_ENABLE_CORS: false
ports:
- "${STREAMLIT_PORT:-8501}:8501"
volumes:
- ./src:/app/src
- ./examples:/app/examples
networks:
- antifragile_network
command: streamlit run examples/app.py
restart: unless-stopped
# FastAPI service for API implementation
fastapi:
build:
context: .
dockerfile: docker/fastapi.Dockerfile
container_name: antifragile_fastapi
depends_on:
postgres:
condition: service_healthy
environment:
APP_ENV: ${APP_ENV:-development}
DATABASE_URL: ${DATABASE_URL:-postgresql://postgres:postgres@postgres:5432/postgres}
LOG_LEVEL: ${LOG_LEVEL:-info}
PORT: ${API_PORT:-8001}
ports:
- "${API_PORT:-8001}:${API_PORT:-8001}"
volumes:
- ./src:/app/src
- ./examples:/app/examples
networks:
- antifragile_network
restart: unless-stopped
networks:
antifragile_network:
driver: bridge
volumes:
postgres_data: