78 lines
2.1 KiB
YAML
78 lines
2.1 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# MariaDB Database Service
|
|
db:
|
|
image: mariadb:11.3
|
|
container_name: recticel-db
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpassword}
|
|
MYSQL_DATABASE: trasabilitate
|
|
MYSQL_USER: trasabilitate
|
|
MYSQL_PASSWORD: Initial01!
|
|
ports:
|
|
- "${DB_PORT:-3306}:3306"
|
|
volumes:
|
|
- /srv/docker-test/mariadb:/var/lib/mysql
|
|
- ./init-db.sql:/docker-entrypoint-initdb.d/01-init.sql
|
|
networks:
|
|
- recticel-network
|
|
healthcheck:
|
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# Flask Web Application Service
|
|
web:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: recticel-app
|
|
restart: unless-stopped
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
environment:
|
|
# Database connection settings
|
|
DB_HOST: db
|
|
DB_PORT: 3306
|
|
DB_NAME: trasabilitate
|
|
DB_USER: trasabilitate
|
|
DB_PASSWORD: Initial01!
|
|
|
|
# Application settings
|
|
FLASK_ENV: production
|
|
FLASK_APP: run.py
|
|
|
|
# Initialization flags (set to "false" after first run if needed)
|
|
INIT_DB: "true"
|
|
SEED_DB: "true"
|
|
ports:
|
|
- "${APP_PORT:-8781}:8781"
|
|
volumes:
|
|
# Mount logs directory for persistence
|
|
- /srv/docker-test/logs:/srv/quality_recticel/logs
|
|
# Mount instance directory for config persistence
|
|
- /srv/docker-test/instance:/app/instance
|
|
# Mount app code for easy updates (DISABLED - causes config issues)
|
|
# Uncomment only for development, not production
|
|
# - /srv/docker-test/app:/app
|
|
networks:
|
|
- recticel-network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8781/"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
networks:
|
|
recticel-network:
|
|
driver: bridge
|
|
|
|
# Note: Using bind mounts to /srv/docker-test/ instead of named volumes
|
|
# This allows easier access and management of persistent data
|