Created
July 10, 2016 03:54
-
-
Save fernandodebrando/cdb5e2a8ea5aee18f74addf89baefbb1 to your computer and use it in GitHub Desktop.
Criando um ambiente de desenvolvimento PHP com 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
php: | |
build: ./Dockerfile | |
ports: | |
- "81:81" | |
- "443:443" | |
volumes: | |
- ./www:/var/www/html | |
links: | |
- db | |
db: | |
image: mysql:5.7 | |
volumes: | |
- /var/lib/mysql | |
environment: | |
- MYSQL_ROOT_PASSWORD=phprs | |
- MYSQL_DATABASE=phprs |
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
FROM php:5.6-apache | |
RUN docker-php-ext-install mysqli |
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
<?php | |
echo "<pre><h2>Criando um ambiente de desenvolvimento PHP com Docker Compose.</h2></pre><br/>"; | |
mysqli_connect("db", "root", "phprs") or die(mysqli_error()); | |
echo "<pre><h3>Connected to MySQL<h3></pre><br/>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para adicionar uma interface gráfica para gerenciamento do banco de dados (o famoso "phpmyadmin"), basta adicionar as seguintes linhas ao seu
docker-compose.yml
:e rodar o comando: