126 lines
2.9 KiB
YAML
126 lines
2.9 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# Hockey Results Application
|
|
hockey-app:
|
|
build:
|
|
context: .
|
|
dockerfile: Containerfile
|
|
container_name: hockey-results-app
|
|
ports:
|
|
- "5000:5000"
|
|
environment:
|
|
- DATABASE_TYPE=postgresql
|
|
- POSTGRES_HOST=postgres
|
|
- POSTGRES_PORT=5432
|
|
- POSTGRES_DATABASE=hockey_results
|
|
- POSTGRES_USER=hockey_user
|
|
- POSTGRES_PASSWORD=hockey_password
|
|
- FLASK_ENV=production
|
|
- SECRET_KEY=your-secret-key-change-in-production
|
|
- BASIC_AUTH_USERNAME=admin
|
|
- BASIC_AUTH_PASSWORD=letmein
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./logs:/app/logs
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
networks:
|
|
- hockey-network
|
|
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: hockey-postgres
|
|
environment:
|
|
- POSTGRES_DB=hockey_results
|
|
- POSTGRES_USER=hockey_user
|
|
- POSTGRES_PASSWORD=hockey_password
|
|
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init-scripts:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U hockey_user -d hockey_results"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
networks:
|
|
- hockey-network
|
|
|
|
# MariaDB Database (Alternative)
|
|
mariadb:
|
|
image: mariadb:10.11
|
|
container_name: hockey-mariadb
|
|
environment:
|
|
- MYSQL_ROOT_PASSWORD=root_password
|
|
- MYSQL_DATABASE=hockey_results
|
|
- MYSQL_USER=hockey_user
|
|
- MYSQL_PASSWORD=hockey_password
|
|
- MYSQL_CHARSET=utf8mb4
|
|
- MYSQL_COLLATION=utf8mb4_unicode_ci
|
|
volumes:
|
|
- mariadb_data:/var/lib/mysql
|
|
- ./init-scripts:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "3306:3306"
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "hockey_user", "-p$$MYSQL_PASSWORD"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
networks:
|
|
- hockey-network
|
|
profiles:
|
|
- mariadb
|
|
|
|
# Redis for caching (optional)
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: hockey-redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
restart: unless-stopped
|
|
networks:
|
|
- hockey-network
|
|
profiles:
|
|
- redis
|
|
|
|
# Nginx reverse proxy (optional)
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: hockey-nginx
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./ssl:/etc/nginx/ssl:ro
|
|
depends_on:
|
|
- hockey-app
|
|
restart: unless-stopped
|
|
networks:
|
|
- hockey-network
|
|
profiles:
|
|
- nginx
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
mariadb_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
hockey-network:
|
|
driver: bridge
|