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:
@@ -1,6 +1,26 @@
|
||||
# =============================================================================
|
||||
# Aegis - MITRE ATT&CK Coverage Platform
|
||||
# =============================================================================
|
||||
#
|
||||
# Quick Start:
|
||||
# docker-compose up -d
|
||||
# docker-compose exec backend alembic upgrade head
|
||||
# docker-compose exec backend python -m app.seed
|
||||
#
|
||||
# Access:
|
||||
# - Frontend: http://localhost:5173
|
||||
# - Backend API: http://localhost:8000
|
||||
# - Swagger UI: http://localhost:8000/docs
|
||||
# - MinIO Console: http://localhost:9001 (minioadmin/minioadmin)
|
||||
#
|
||||
# Default credentials: admin / admin123
|
||||
# =============================================================================
|
||||
|
||||
services:
|
||||
# ── PostgreSQL Database ────────────────────────────────────────────────────
|
||||
postgres:
|
||||
image: postgres:15
|
||||
image: postgres:15-alpine
|
||||
container_name: aegis-postgres
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
@@ -9,32 +29,91 @@ services:
|
||||
- "5433:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d attackdb"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
# ── MinIO Object Storage ───────────────────────────────────────────────────
|
||||
minio:
|
||||
image: minio/minio
|
||||
image: minio/minio:latest
|
||||
container_name: aegis-minio
|
||||
command: server /data --console-address ":9001"
|
||||
environment:
|
||||
MINIO_ROOT_USER: minioadmin
|
||||
MINIO_ROOT_PASSWORD: minioadmin
|
||||
ports:
|
||||
- "9000:9000"
|
||||
- "9001:9001"
|
||||
- "9000:9000" # API
|
||||
- "9001:9001" # Console
|
||||
volumes:
|
||||
- minio_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "mc", "ready", "local"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
# ── FastAPI Backend ────────────────────────────────────────────────────────
|
||||
backend:
|
||||
build: ./backend
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: aegis-backend
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
# Database
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/attackdb
|
||||
# Security (change in production!)
|
||||
SECRET_KEY: change-me-in-production-use-a-long-random-string
|
||||
ALGORITHM: HS256
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: 60
|
||||
# MinIO
|
||||
MINIO_ENDPOINT: minio:9000
|
||||
MINIO_ACCESS_KEY: minioadmin
|
||||
MINIO_SECRET_KEY: minioadmin
|
||||
MINIO_BUCKET: evidence
|
||||
MINIO_SECURE: "false"
|
||||
depends_on:
|
||||
- postgres
|
||||
- minio
|
||||
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
minio:
|
||||
condition: service_started
|
||||
volumes:
|
||||
- ./backend:/app
|
||||
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
# ── React Frontend (Development) ───────────────────────────────────────────
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
target: development
|
||||
container_name: aegis-frontend
|
||||
ports:
|
||||
- "5173:5173"
|
||||
environment:
|
||||
# Vite environment variables
|
||||
VITE_API_URL: http://localhost:8000/api/v1
|
||||
depends_on:
|
||||
- backend
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules # Prevent overwriting node_modules
|
||||
restart: unless-stopped
|
||||
|
||||
# ── Volumes ──────────────────────────────────────────────────────────────────
|
||||
volumes:
|
||||
postgres_data:
|
||||
name: aegis_postgres_data
|
||||
minio_data:
|
||||
name: aegis_minio_data
|
||||
|
||||
Reference in New Issue
Block a user