Last active
May 31, 2026 08:54
-
-
Save ozh/aaa44bc47039d935032a3e8fb0ec50e7 to your computer and use it in GitHub Desktop.
My docker config 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
| DocumentRoot /var/www/html | |
| <Directory /var/www/html> | |
| Options Indexes FollowSymLinks | |
| AllowOverride All | |
| Require all granted | |
| </Directory> | |
| DirectoryIndex index.php index.html index.htm |
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
| <VirtualHost *:443> | |
| DocumentRoot /var/www/html | |
| SSLEngine on | |
| SSLCertificateFile /etc/ssl/local/dev.crt | |
| SSLCertificateKeyFile /etc/ssl/local/dev.key | |
| <Directory /var/www/html> | |
| Options Indexes FollowSymLinks | |
| AllowOverride All | |
| Require all granted | |
| </Directory> | |
| </VirtualHost> |
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 | |
| - ./pg_hba.conf:/var/lib/postgresql/data/pg_hba.conf | |
| 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 dependencies | |
| # ------------------------- | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| unzip \ | |
| curl \ | |
| ca-certificates \ | |
| libzip-dev \ | |
| libpq-dev \ | |
| libicu-dev \ | |
| && update-ca-certificates \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ------------------------- | |
| # PHP extensions | |
| # ------------------------- | |
| RUN docker-php-ext-install \ | |
| pdo \ | |
| pdo_mysql \ | |
| mysqli \ | |
| pdo_pgsql \ | |
| zip \ | |
| bcmath | |
| # ------------------------- | |
| # Apache modules | |
| # ------------------------- | |
| RUN a2enmod rewrite headers ssl | |
| # ------------------------- | |
| # Xdebug (dev only) | |
| # ------------------------- | |
| RUN pecl install xdebug \ | |
| && docker-php-ext-enable xdebug | |
| RUN { \ | |
| echo "xdebug.mode=debug,develop,coverage"; \ | |
| echo "xdebug.start_with_request=yes"; \ | |
| echo "xdebug.client_host=host.docker.internal"; \ | |
| echo "xdebug.client_port=9003"; \ | |
| echo "xdebug.log=/tmp/xdebug.log"; \ | |
| } > /usr/local/etc/php/conf.d/xdebug.ini | |
| RUN touch /tmp/xdebug.log && chmod 777 /tmp/xdebug.log | |
| # ------------------------- | |
| # PHP / cURL safety fix (IMPORTANT) | |
| # ------------------------- | |
| RUN { \ | |
| echo "curl.cainfo=/etc/ssl/certs/ca-certificates.crt"; \ | |
| echo "openssl.cafile=/etc/ssl/certs/ca-certificates.crt"; \ | |
| } > /usr/local/etc/php/conf.d/certs.ini | |
| # ------------------------- | |
| # Composer | |
| # ------------------------- | |
| COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | |
| # ------------------------- | |
| # PHPUnit (global phar) | |
| # ------------------------- | |
| COPY phpunit.phar /usr/local/bin/phpunit | |
| RUN chmod +x /usr/local/bin/phpunit | |
| # ------------------------- | |
| # Shell prompt | |
| # ------------------------- | |
| RUN echo 'export PS1="🐳 \e[1;36m\h\e[0m:\e[1;33m\w\e[0m# "' >> /etc/bash.bashrc |
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
| # TYPE DATABASE USER ADDRESS METHOD | |
| local all all trust | |
| host all all 127.0.0.1/32 trust | |
| host all all ::1/128 trust | |
| local replication all trust | |
| host replication all 127.0.0.1/32 trust | |
| host replication all ::1/128 trust | |
| host all all 172.16.0.0/12 trust | |
| host all all all scram-sha-256 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rebuild image :