Name Command State Ports
-------------------------------------------------------------------------------
app docker-php-entrypoint php-fpm Up 9000/tcp
app-postgres docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp
app-webserver nginx -g daemon off; Exit 1
version: '3.1'
services:
postgres:
image: postgres:9.5-alpine
container_name: app-postgres
volumes:
- "./postgres:/var/lib/postgresql/data"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- "5432:5432"
networks:
testing_net:
ipv4_address: 172.28.1.2
app:
build:
context: .
dockerfile: Dockerfile
image: digitalocean.com/php
container_name: app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./app:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
webserver:
image: nginx:alpine
container_name: app-webserver
working_dir: /var/www
volumes:
- ./app:/var/www
- ./nginx:/etc/nginx/conf.d
ports:
- "80:80"
networks:
testing_net:
ipv4_address: 172.28.1.3
networks:
testing_net:
ipam:
driver: default
config:
- subnet: 172.28.0.0/16
app-network:
driver: bridge
server {
listen 80 default;
client_max_body_size 108M;
access_log /var/log/nginx/application.access.log;
error_log /var/log/nginx/application.error.log;
root /var/www/public;
index index.php;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
location ~ \.php$ {
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
include fastcgi_params;
}
}
docker-compose up -d nginx mysql phpmyadmin