├── README.md ├── docker-compose.yml ├── index.php ├── nginx └── default.conf └── php └── Dockerfile /README.md: -------------------------------------------------------------------------------- 1 | # dev-docker 2 | Utilizaremos este repositório para armazenar os arquivos de configuração de um ambiente de desenvolvimento utilizando Docker. Você 3 | encontrará aqui os arquivos utilizados de exemplo no post: http://www.mundodocker.com.br/desenvolvimento-com-docker/ onde ilustramos como é possível utilizar o Docker para automatizar o seu deploy de ambiente para as equipes de desenvolvimento. 4 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # Utilizando sintax da versão 2: 2 | # https://docs.docker.com/compose/compose-file/#/versioning 3 | version: '2' 4 | 5 | volumes: 6 | database_data: 7 | driver: local 8 | 9 | services: 10 | ########################### 11 | # Container Web (Nginx) 12 | ########################### 13 | nginx: 14 | image: nginx:latest 15 | ports: 16 | - 8080:80 17 | volumes: 18 | - ./nginx/default.conf:/etc/nginx/conf.d/default.conf 19 | volumes_from: 20 | - php 21 | 22 | ########################### 23 | # Container PHP 24 | ########################### 25 | php: 26 | build: ./php/ 27 | expose: 28 | - 9000 29 | volumes: 30 | - .:/var/www/html 31 | 32 | ########################### 33 | # Container de teste 34 | ########################### 35 | testing: 36 | build: ./php/ 37 | volumes_from: 38 | - php 39 | 40 | ########################### 41 | # Container de banco de dados (MySQL) 42 | ########################### 43 | mysql: 44 | image: mysql:latest 45 | expose: 46 | - 3306 47 | volumes: 48 | - database_data:/var/lib/mysql 49 | environment: 50 | MYSQL_ROOT_PASSWORD: senha 51 | MYSQL_DATABASE: projeto 52 | MYSQL_USER: projeto 53 | MYSQL_PASSWORD: projeto 54 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /nginx/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | 3 | # Set the port to listen on and the server name 4 | listen 80 default_server; 5 | 6 | # Set the document root of the project 7 | root /var/www/html; 8 | 9 | # Set the directory index files 10 | index index.php; 11 | 12 | # Specify the default character set 13 | charset utf-8; 14 | 15 | # Setup the default location configuration 16 | location / { 17 | try_files $uri $uri/ /index.php; 18 | } 19 | 20 | # Specify the details of favicon.ico 21 | location = /favicon.ico { access_log off; log_not_found off; } 22 | 23 | # Specify the details of robots.txt 24 | location = /robots.txt { access_log off; log_not_found off; } 25 | 26 | # Specify the logging configuration 27 | access_log /var/log/nginx/access.log; 28 | error_log /var/log/nginx/error.log; 29 | 30 | sendfile off; 31 | 32 | client_max_body_size 100m; 33 | 34 | # Specify what happens when PHP files are requested 35 | location ~ \.php$ { 36 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 37 | fastcgi_pass php:9000; 38 | fastcgi_index index.php; 39 | include fastcgi_params; 40 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 41 | fastcgi_param APPLICATION_ENV development; 42 | fastcgi_intercept_errors off; 43 | fastcgi_buffer_size 16k; 44 | fastcgi_buffers 4 16k; 45 | } 46 | 47 | # Specify what happens what .ht files are requested 48 | location ~ /\.ht { 49 | deny all; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /php/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:7.0-fpm 2 | 3 | RUN docker-php-ext-install pdo_mysql \ 4 | && docker-php-ext-install json 5 | --------------------------------------------------------------------------------