version: '3.8' services: # Complete Inventory Solution (Single Container) inventory-app: build: context: . dockerfile: Dockerfile container_name: inventory-app ports: - "${FRONTEND_PORT:-80}:80" environment: - DB_HOST=${DB_HOST:-mariadb} - DB_PORT=${DB_PORT:-3306} - DB_NAME=${DB_NAME:-inventory_db} - DB_USER=${DB_USER:-inventory_user} - DB_PASS=${DB_PASS:-inventory_password} - REDIS_HOST=${REDIS_HOST:-redis} - REDIS_PORT=${REDIS_PORT:-6379} - COMPANY_NAME=${COMPANY_NAME:-Inventory Management} - COMPANY_ADDRESS=${COMPANY_ADDRESS:-123 Business St} - COMPANY_CITY=${COMPANY_CITY:-Helsinki} - COMPANY_POSTAL_CODE=${COMPANY_POSTAL_CODE:-00100} - COMPANY_COUNTRY=${COMPANY_COUNTRY:-Finland} - COMPANY_PHONE=${COMPANY_PHONE:-+358 123 456 789} - COMPANY_EMAIL=${COMPANY_EMAIL:-info@company.com} - COMPANY_Y_TUNNUS=${COMPANY_Y_TUNNUS:-1234567-8} - UPLOAD_MAX_SIZE=${UPLOAD_MAX_SIZE:-10M} - ALLOWED_FILE_TYPES=${ALLOWED_FILE_TYPES:-pdf,doc,docx,xls,xlsx,jpg,jpeg,png,gif} volumes: - ${APP_LOCATION}/uploads:/var/www/html/uploads restart: unless-stopped depends_on: - mariadb - redis healthcheck: test: ["CMD", "curl", "-f", "http://localhost/api/company.php"] interval: 30s timeout: 10s retries: 3 start_period: 40s # MariaDB Database Service mariadb: image: mariadb:10.11 container_name: inventory-mariadb ports: - "${MARIADB_PORT:-3306}:3306" environment: - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root_password} - MYSQL_DATABASE=${DB_NAME:-inventory_db} - MYSQL_USER=${DB_USER:-inventory_user} - MYSQL_PASSWORD=${DB_PASS:-inventory_password} volumes: - ${DB_LOCATION}/mariadb_data:/var/lib/mysql restart: unless-stopped healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD:-root_password}"] interval: 30s timeout: 10s retries: 3 start_period: 40s # Redis Cache Service redis: image: redis:7-alpine container_name: inventory-redis ports: - "${REDIS_PORT:-6379}:6379" volumes: - ${REDIS_LOCATION}/redis_data:/data restart: unless-stopped command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD:-redis_password} healthcheck: test: ["CMD", "redis-cli", "--raw", "incr", "ping"] interval: 30s timeout: 10s retries: 3 start_period: 40s volumes: mariadb_data: driver: local redis_data: driver: local networks: default: name: inventory-network driver: bridge