New_Micro_Learning/docker-compose.production.yml

87 خطوط
2.9 KiB
YAML

name: microlearn
services:
app:
build:
context: .
dockerfile: infrastructure/docker/php/Dockerfile
env_file: ${MICROLEARN_ENV_FILE:-infrastructure/production/.env.production}
depends_on:
mysql: { condition: service_healthy }
redis: { condition: service_healthy }
minio: { condition: service_healthy }
volumes:
- app-storage:/var/www/backend/storage/app
restart: unless-stopped
healthcheck:
test: ["CMD", "php", "artisan", "about", "--only=environment"]
interval: 30s
timeout: 10s
retries: 3
worker:
build:
context: .
dockerfile: infrastructure/docker/php/Dockerfile
command: ["php", "artisan", "queue:work", "--sleep=2", "--tries=3", "--timeout=600", "--max-time=3600"]
env_file: ${MICROLEARN_ENV_FILE:-infrastructure/production/.env.production}
depends_on: { app: { condition: service_healthy } }
volumes: ["app-storage:/var/www/backend/storage/app"]
restart: unless-stopped
scheduler:
build:
context: .
dockerfile: infrastructure/docker/php/Dockerfile
command: ["php", "artisan", "schedule:work"]
env_file: ${MICROLEARN_ENV_FILE:-infrastructure/production/.env.production}
depends_on: { app: { condition: service_healthy } }
volumes: ["app-storage:/var/www/backend/storage/app"]
restart: unless-stopped
web:
build:
context: .
dockerfile: infrastructure/nginx/Dockerfile
ports: ["${MICROLEARN_HTTP_PORT:-8080}:80"]
depends_on: { app: { condition: service_healthy } }
restart: unless-stopped
mysql:
image: mysql:8.4
environment:
MYSQL_DATABASE: ${MYSQL_DATABASE:-microlearn}
MYSQL_USER: ${MYSQL_USER:-microlearn}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:?Set MYSQL_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:?Set MYSQL_ROOT_PASSWORD}
volumes: ["mysql-data:/var/lib/mysql"]
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -u$$MYSQL_USER -p$$MYSQL_PASSWORD --silent"]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
redis:
image: redis:7.4-alpine
command: ["redis-server", "--appendonly", "yes", "--requirepass", "${REDIS_PASSWORD:?Set REDIS_PASSWORD}"]
volumes: ["redis-data:/data"]
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
minio:
image: minio/minio:RELEASE.2025-07-23T15-54-02Z
command: server /data --console-address :9001
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:?Set MINIO_ROOT_USER}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:?Set MINIO_ROOT_PASSWORD}
volumes: ["object-data:/data"]
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
volumes:
mysql-data:
redis-data:
object-data:
app-storage: