dumbo/examples/docker-nginx/docker-compose.yml

43 lines
1.7 KiB
YAML

services:
# Nginx Web Server
web:
image: nginx:latest # Use the latest official Nginx image
ports:
- "8080:80" # Map port 8080 on the host to port 80 in the container
volumes:
- .:/var/www/html # Mount the current directory to the web root inside the container
- ./Docker/nginx.conf:/etc/nginx/conf.d/default.conf # Use custom Nginx configuration
depends_on:
- app # Ensure the PHP-FPM service is started before Nginx
networks:
- app_network
# PHP-FPM Service
app:
build:
context: . # Use the current directory to build the Dockerfile
dockerfile: Dockerfile # Use the specified Dockerfile
networks:
- app_network
volumes:
- .:/var/www/html # Mount the current directory to the web root inside the container
depends_on:
- composer # Ensure the composer service runs before starting the app service
# Composer service for managing PHP dependencies
composer:
image: composer:2.2 # Use the official Composer image, version 2.2
working_dir: /var/www/html # Set the working directory inside the container to /var/www/html
volumes:
- .:/var/www/html # Mount the current directory to /var/www/html in the container
entrypoint:
- composer # Override the default entrypoint to run Composer commands
- "--ignore-platform-reqs" # Ignore platform requirements during installation
- "--no-progress" # Disable the progress display for a cleaner output
- "--no-ansi" # Disable ANSI colors in the output
command: ["install"] # Install PHP dependencies defined in composer.json
networks:
app_network:
driver: bridge # Use the bridge network driver