Last active
March 28, 2023 15:57
-
-
Save bronhy/82b86c3a9e043f432266d992bd60d0b0 to your computer and use it in GitHub Desktop.
docker compose with apache php mysql phpmyadmin
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
| # This setup avoids dockerfile and is used for quick starts and testing. Do not use in production | |
| # Command in the web service is used for installing mysqli and pdo_mysql extensions. Extension mysqlnd is already present | |
| version: "3.8" | |
| services: | |
| web: | |
| image: php:apache # latest php:apache image | |
| ports: | |
| - "80:80" | |
| command: > | |
| bash -c "docker-php-ext-install mysqli pdo_mysql | |
| && apache2-foreground" | |
| volumes: | |
| - ./:/var/www/html/ | |
| environment: | |
| APACHE_DOCUMENT_ROOT: var/www/html/public | |
| MYSQL_USER: user | |
| MYSQL_PASSWORD: password | |
| depends_on: | |
| - db | |
| db: | |
| image: mysql # latest mysql image | |
| ports: | |
| - "3306:3306" | |
| volumes: | |
| - db_data:/var/lib/mysql | |
| # - ./migrations:/docker-entrypoint-initdb.d # used for database init scripts | |
| environment: | |
| MYSQL_DATABASE: test_db | |
| MYSQL_USER: user | |
| MYSQL_PASSWORD: password | |
| MYSQL_ROOT_PASSWORD: root | |
| phpmyadmin: | |
| image: phpmyadmin/phpmyadmin # latest phpmyadmin image | |
| ports: | |
| - 8080:80 | |
| environment: | |
| MYSQL_USER: user | |
| MYSQL_PASSWORD: password | |
| MYSQL_ROOT_PASSWORD: root | |
| depends_on: | |
| - db | |
| volumes: | |
| db_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment