version: '3.8'

services:

  php:
    container_name: ieducar-php
    build: docker/php
    links:
      - postgres
      - redis
    environment:
      CACHE_DRIVER: redis
      REDIS_HOST: redis
      DB_HOST: postgres
      PGPASSWORD: ieducar
    working_dir: /var/www/ieducar
    volumes:
      - ./:/var/www/ieducar

  nginx:
    container_name: ieducar-nginx
    image: nginx:alpine
    links:
      - php
    working_dir: /var/www/ieducar
    volumes:
      - ./:/var/www/ieducar
      - ./docker/nginx:/etc/nginx/conf.d/

  postgres:
    container_name: ieducar-postgres
    image: postgres:alpine
    environment:
      POSTGRES_DB: ieducar
      POSTGRES_USER: ieducar
      POSTGRES_PASSWORD: ieducar
    volumes:
      - postgres:/var/lib/postgresql/data

  redis:
    container_name: ieducar-redis
    image: redis:alpine
    restart: always

volumes:
    postgres:
