Skip to content

Instantly share code, notes, and snippets.

@cleytonferrari cleytonferrari/README.md
Last active Apr 20, 2017

Embed
What would you like to do?
Configuração de ambiente PHP

Ambiente PHP / MySQL

Exemplo de configuração do Docker para ambiente PHP / MySQL

1. Criar a estrutura de diretorios e arquivos

c:\> mkdir PHP
c:\> mkdir PHP\www

No diretorio PHP adicione o arquivo Dockerfile

FROM php:5.6-apache
RUN docker-php-ext-install mysqli
RUN a2enmod rewrite
RUN apt-get update -y && apt-get install -y libpng-dev zlib1g-dev
RUN docker-php-ext-install zip
RUN docker-php-ext-install gd

No diretorio PHP\www adicione o arquivo docker-compose.yml

php:
  build: ../
  ports:
   - "80:80"
   - "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

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  links:
    - db
  environment:
    PMA_HOST: db
    PMA_PORT: 3306
  ports:
    - '8080:80'

2. Docker

Build

c:\PHP\www\> docker-compose build

Rodando o ambiente

c:\PHP\www\> docker-compose up -d

Parar o ambiente

c:\PHP\www\> docker-compose down

Para saber mais http://www.phprs.com.br/2016/05/criando-um-ambiente-de-desenvolvimento-php-com-docker-compose/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.