feat: add complete Docker setup for testing
- Update docker-compose.yml with frontend service and healthchecks - Add frontend Dockerfile with dev and production stages - Add nginx.conf for production frontend serving - Add docker-compose.prod.yml for production deployment - Add .env.example with all configuration options - Add init scripts (init.sh, init.ps1) for easy setup
This commit is contained in:
106
docker-compose.prod.yml
Normal file
106
docker-compose.prod.yml
Normal file
@@ -0,0 +1,106 @@
|
||||
# =============================================================================
|
||||
# Aegis - Production Docker Compose
|
||||
# =============================================================================
|
||||
#
|
||||
# Usage:
|
||||
# docker-compose -f docker-compose.prod.yml up -d --build
|
||||
#
|
||||
# Note: Set environment variables in .env file or via environment
|
||||
# =============================================================================
|
||||
|
||||
services:
|
||||
# ── PostgreSQL Database ────────────────────────────────────────────────────
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: aegis-postgres
|
||||
environment:
|
||||
POSTGRES_USER: ${DB_USER:-postgres}
|
||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
||||
POSTGRES_DB: ${DB_NAME:-attackdb}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-attackdb}"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: always
|
||||
networks:
|
||||
- aegis-network
|
||||
|
||||
# ── MinIO Object Storage ───────────────────────────────────────────────────
|
||||
minio:
|
||||
image: minio/minio:latest
|
||||
container_name: aegis-minio
|
||||
command: server /data --console-address ":9001"
|
||||
environment:
|
||||
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin}
|
||||
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minioadmin}
|
||||
volumes:
|
||||
- minio_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "mc", "ready", "local"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: always
|
||||
networks:
|
||||
- aegis-network
|
||||
|
||||
# ── FastAPI Backend ────────────────────────────────────────────────────────
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: aegis-backend
|
||||
environment:
|
||||
DATABASE_URL: postgresql://${DB_USER:-postgres}:${DB_PASSWORD:-postgres}@postgres:5432/${DB_NAME:-attackdb}
|
||||
SECRET_KEY: ${SECRET_KEY:?Set SECRET_KEY in environment}
|
||||
ALGORITHM: HS256
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: ${TOKEN_EXPIRE_MINUTES:-60}
|
||||
MINIO_ENDPOINT: minio:9000
|
||||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
|
||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
|
||||
MINIO_BUCKET: ${MINIO_BUCKET:-evidence}
|
||||
MINIO_SECURE: "false"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_started
|
||||
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: always
|
||||
networks:
|
||||
- aegis-network
|
||||
|
||||
# ── React Frontend (Production with Nginx) ─────────────────────────────────
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
target: production
|
||||
container_name: aegis-frontend
|
||||
ports:
|
||||
- "${FRONTEND_PORT:-80}:80"
|
||||
depends_on:
|
||||
- backend
|
||||
restart: always
|
||||
networks:
|
||||
- aegis-network
|
||||
|
||||
# ── Networks ─────────────────────────────────────────────────────────────────
|
||||
networks:
|
||||
aegis-network:
|
||||
driver: bridge
|
||||
|
||||
# ── Volumes ──────────────────────────────────────────────────────────────────
|
||||
volumes:
|
||||
postgres_data:
|
||||
name: aegis_postgres_data_prod
|
||||
minio_data:
|
||||
name: aegis_minio_data_prod
|
||||
Reference in New Issue
Block a user