|
| 1 | +services: |
| 2 | + web: |
| 3 | + image: nginx:latest # Using the default Nginx image with custom configuration. |
| 4 | + volumes: |
| 5 | + # Mount the application code for live updates |
| 6 | + - ./:/var/www |
| 7 | + # Mount the Nginx configuration file |
| 8 | + - ./docker/development/nginx/nginx.conf:/etc/nginx/nginx.conf:ro |
| 9 | + ports: |
| 10 | + # Map port 80 inside the container to the port specified by 'NGINX_PORT' on the host machine |
| 11 | + - "80:80" |
| 12 | + environment: |
| 13 | + - NGINX_HOST=localhost |
| 14 | + networks: |
| 15 | + - laravel-development |
| 16 | + depends_on: |
| 17 | + php-fpm: |
| 18 | + condition: service_started # Wait for php-fpm to start |
| 19 | + |
| 20 | + php-fpm: |
| 21 | + # For the php-fpm service, we will create a custom image to install the necessary PHP extensions and setup proper permissions. |
| 22 | + build: |
| 23 | + context: . |
| 24 | + dockerfile: ./docker/development/php-fpm/Dockerfile |
| 25 | + args: |
| 26 | + UID: ${UID:-1000} |
| 27 | + GID: ${GID:-1000} |
| 28 | + XDEBUG_ENABLED: ${XDEBUG_ENABLED:-true} |
| 29 | + XDEBUG_MODE: develop,coverage,debug,profile |
| 30 | + XDEBUG_HOST: ${XDEBUG_HOST:-host.docker.internal} |
| 31 | + XDEBUG_IDE_KEY: ${XDEBUG_IDE_KEY:-DOCKER} |
| 32 | + XDEBUG_LOG: /dev/stdout |
| 33 | + XDEBUG_LOG_LEVEL: 0 |
| 34 | + env_file: |
| 35 | + # Load the environment variables from the Laravel application |
| 36 | + - .env |
| 37 | + user: "${UID:-1000}:${GID:-1000}" |
| 38 | + volumes: |
| 39 | + # Mount the application code for live updates |
| 40 | + - ./:/var/www |
| 41 | + networks: |
| 42 | + - laravel-development |
| 43 | + depends_on: |
| 44 | + postgres: |
| 45 | + condition: service_started # Wait for postgres to start |
| 46 | + |
| 47 | + workspace: |
| 48 | + # For the workspace service, we will also create a custom image to install and setup all the necessary stuff. |
| 49 | + build: |
| 50 | + context: . |
| 51 | + dockerfile: ./docker/development/workspace/Dockerfile |
| 52 | + args: |
| 53 | + UID: ${UID:-1000} |
| 54 | + GID: ${GID:-1000} |
| 55 | + XDEBUG_ENABLED: ${XDEBUG_ENABLED:-true} |
| 56 | + XDEBUG_MODE: develop,coverage,debug,profile |
| 57 | + XDEBUG_HOST: ${XDEBUG_HOST:-host.docker.internal} |
| 58 | + XDEBUG_IDE_KEY: ${XDEBUG_IDE_KEY:-DOCKER} |
| 59 | + XDEBUG_LOG: /dev/stdout |
| 60 | + XDEBUG_LOG_LEVEL: 0 |
| 61 | + tty: true # Enables an interactive terminal |
| 62 | + stdin_open: true # Keeps standard input open for 'docker exec' |
| 63 | + env_file: |
| 64 | + - .env |
| 65 | + volumes: |
| 66 | + - ./:/var/www |
| 67 | + networks: |
| 68 | + - laravel-development |
| 69 | + |
| 70 | + postgres: |
| 71 | + image: postgres:16 |
| 72 | + ports: |
| 73 | + - "${POSTGRES_PORT:-5432}:5432" |
| 74 | + environment: |
| 75 | + - POSTGRES_DB=app |
| 76 | + - POSTGRES_USER=laravel |
| 77 | + - POSTGRES_PASSWORD=secret |
| 78 | + volumes: |
| 79 | + - postgres-data-development:/var/lib/postgresql/data |
| 80 | + networks: |
| 81 | + - laravel-development |
| 82 | + |
| 83 | + redis: |
| 84 | + image: redis:alpine |
| 85 | + networks: |
| 86 | + - laravel-development |
| 87 | + |
| 88 | +networks: |
| 89 | + laravel-development: |
| 90 | + |
| 91 | +volumes: |
| 92 | + postgres-data-development: |
0 commit comments