version: '3.8' services: # Laravel App app: build: context: ./docker/php dockerfile: Dockerfile container_name: app restart: always working_dir: /var/www volumes: - .:/var/www command: > /bin/sh -c 'mkdir -p /var/www/storage /var/www/bootstrap/cache && chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache && chmod -R 775 /var/www/storage /var/www/bootstrap/cache && composer install --no-dev --optimize-autoloader && php artisan migrate --force && php-fpm' healthcheck: test: [ "CMD", "sh", "-c", "pgrep php-fpm" ] interval: 30s timeout: 10s retries: 10 networks: - api_network environment: - DB_HOST=db_mysql - DB_PORT=3306 - DB_DATABASE=unioil-app - DB_USERNAME=rootuser - DB_PASSWORD=password # Nginx web-frontend: image: nginx:1.26.3-alpine container_name: web-frontend restart: always ports: - "8000:80" expose: - "80" volumes: - .:/var/www - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:rw depends_on: app: condition: service_healthy healthcheck: test: [ "CMD", "curl", "-f", "http://localhost" ] interval: 30s timeout: 10s retries: 5 networks: - api_network networks: api_network: external: true driver: bridge