Skip to content

Instantly share code, notes, and snippets.

@locserd
Forked from fernandodebrando/Dockerfile
Created May 10, 2023 18:56
Show Gist options
  • Save locserd/9e144225d1ace88808873d0258d2f156 to your computer and use it in GitHub Desktop.
Save locserd/9e144225d1ace88808873d0258d2f156 to your computer and use it in GitHub Desktop.
Criando um ambiente de desenvolvimento PHP com Docker Compose
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
FROM php:5.6-apache
RUN docker-php-ext-install mysqli
<?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