Created
April 18, 2026 14:31
-
-
Save ozh/aaa44bc47039d935032a3e8fb0ec50e7 to your computer and use it in GitHub Desktop.
My docker for web dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| web: | |
| build: . | |
| container_name: dev-web | |
| ports: | |
| - "80:80" | |
| - "443:443" | |
| volumes: | |
| - ./:/var/www/html | |
| - ./.ssl:/etc/ssl/local | |
| - ./apache.conf:/etc/apache2/sites-enabled/000-default.conf | |
| - ./default-ssl.conf:/etc/apache2/sites-available/default-ssl.conf | |
| depends_on: | |
| - mariadb | |
| - postgres | |
| extra_hosts: | |
| - "host.docker.internal:host-gateway" | |
| command: bash -c " | |
| a2enmod ssl rewrite headers && | |
| a2ensite default-ssl && | |
| apache2-foreground" | |
| mariadb: | |
| image: mariadb:11 | |
| container_name: dev-mariadb | |
| environment: | |
| MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "yes" | |
| MARIADB_DATABASE: dev | |
| ports: | |
| - "3306:3306" | |
| volumes: | |
| - mariadb_data:/var/lib/mysql | |
| postgres: | |
| image: postgres:16 | |
| container_name: dev-postgres | |
| environment: | |
| POSTGRES_PASSWORD: root | |
| POSTGRES_DB: dev | |
| ports: | |
| - "5432:5432" | |
| volumes: | |
| - postgres_data:/var/lib/postgresql/data | |
| phpmyadmin: | |
| image: phpmyadmin:latest | |
| container_name: dev-phpmyadmin | |
| depends_on: | |
| - mariadb | |
| environment: | |
| PMA_HOST: mariadb | |
| PMA_PORT: 3306 | |
| ports: | |
| - "8080:80" | |
| pgadmin: | |
| image: dpage/pgadmin4 | |
| container_name: dev-pgadmin | |
| depends_on: | |
| - postgres | |
| environment: | |
| PGADMIN_DEFAULT_EMAIL: admin@local.dev | |
| PGADMIN_DEFAULT_PASSWORD: admin | |
| ports: | |
| - "8081:80" | |
| volumes: | |
| mariadb_data: | |
| postgres_data: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM php:8.5-apache | |
| # System deps | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| unzip \ | |
| libpq-dev \ | |
| libzip-dev \ | |
| && docker-php-ext-install \ | |
| pdo \ | |
| pdo_mysql \ | |
| mysqli \ | |
| pdo_pgsql \ | |
| zip \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Enable Apache modules | |
| RUN a2enmod rewrite headers ssl | |
| # Xdebug | |
| RUN pecl install xdebug \ | |
| && docker-php-ext-enable xdebug | |
| # Xdebug config (dev friendly) | |
| RUN echo "xdebug.mode=debug,develop" >> /usr/local/etc/php/conf.d/xdebug.ini \ | |
| && echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/xdebug.ini \ | |
| && echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/xdebug.ini \ | |
| && echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/xdebug.ini |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment