Dockerized everything and added CI/CD deployment
This commit is contained in:
@@ -1,23 +1,81 @@
|
||||
# docker-compose.yml
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:14
|
||||
environment:
|
||||
POSTGRES_USER: maia
|
||||
POSTGRES_PASSWORD: maia
|
||||
POSTGRES_DB: maia
|
||||
ports:
|
||||
- "5432:5432"
|
||||
# ----- Backend API (Uvicorn/FastAPI/Django etc.) -----
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: MAIA-API
|
||||
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
redis:
|
||||
image: redis:7
|
||||
- .:/app
|
||||
ports:
|
||||
- "6379:6379"
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DB_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/maia
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
networks:
|
||||
- maia_network
|
||||
env_file:
|
||||
- ./.env
|
||||
restart: unless-stopped
|
||||
|
||||
# ----- Celery Worker -----
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: MAIA-Worker
|
||||
command: celery -A core.celery_app worker --loglevel=info
|
||||
volumes:
|
||||
- .:/app
|
||||
environment:
|
||||
- DB_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/maia
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
env_file:
|
||||
- ./.env
|
||||
networks:
|
||||
- maia_network
|
||||
restart: unless-stopped
|
||||
|
||||
# ----- Database (PostgreSQL) -----
|
||||
db:
|
||||
image: postgres:15 # Use a specific version
|
||||
container_name: MAIA-DB
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data # Persist data using a named volume
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=maia
|
||||
env_file:
|
||||
- ./.env
|
||||
networks:
|
||||
- maia_network
|
||||
restart: unless-stopped
|
||||
|
||||
# ----- Cache (Redis) -----
|
||||
redis:
|
||||
image: redis:7 # Use a specific version
|
||||
container_name: MAIA-Redis
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
networks:
|
||||
- maia_network
|
||||
restart: unless-stopped
|
||||
|
||||
# ----- Volumes Definition -----
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
postgres_data: # Define the named volume for PostgreSQL
|
||||
redis_data: # Define the named volume for Redis
|
||||
|
||||
# ----- Network Definition -----
|
||||
networks:
|
||||
maia_network: # Define a custom bridge network
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user