Last active
July 9, 2020 18:57
-
-
Save EnriqueTejeda/c7e065a7a1b2df7473b6a8728f799474 to your computer and use it in GitHub Desktop.
A example for generate a complete stack web which consist in reverse nginx proxy,webserver, mysql database & phpmyadmin, all with docker-compose
This file contains 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
version : '3' | |
services: | |
mysql: # Up the database | |
image: mariadb:5.5 | |
container_name: mysql | |
environment: | |
MYSQL_USER: user | |
MYSQL_PASSWORD: user | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: default_schema | |
volumes: | |
- ./data/db:/var/lib/mysql # Make all data generate from database persistent in our machine (host machine) | |
phpmyadmin: | |
image: phpmyadmin/phpmyadmin | |
container_name: phpmyadmin | |
links: | |
- mysql # Connect this container with mysql container | |
environment: | |
PMA_HOST: mysql | |
PMA_PORT: 3306 | |
PMA_ARBITRARY: 1 | |
VIRTUAL_HOST: phpmyadmin.local.com | |
restart: always | |
ports: | |
- 80 | |
web: | |
image: php:7.2-apache | |
container_name: web | |
links: | |
- mysql | |
volumes: | |
- ./web-files:/var/www/html/ | |
ports: | |
- 80 | |
environment: | |
- VIRTUAL_HOST=web.local.com # Enable the domain for this container (add in your /etc/hosts the domain pointing to local ip 127.0.0.1) | |
web2: | |
image: php:7.2-apache | |
container_name: web2 | |
volumes: | |
- ./web2-files:/var/www/html/ | |
ports: | |
- 80 | |
environment: | |
- VIRTUAL_HOST=web2.local.com # Enable the domain for this container (add in your /etc/hosts the domain pointing to local ip 127.0.0.1) | |
nginx-proxy: | |
image: jwilder/nginx-proxy | |
ports: | |
- "80:80" | |
volumes: | |
- /var/run/docker.sock:/tmp/docker.sock:ro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment