---
version: '3'

## Warning: this is an inspiration, and should be adapted to your needs

services:
  php:
    build:
      context: .
      args:
        UID: ${PHP_FPM_USER:-1000}
    # uncomment and set your own image if needed
    image: ${IMAGE_PHP-chill_php82}:${VERSION:-latest}
    #
    # normally, you should not mount any volume and use your own image
    #
    volumes:
       - ./.env:/var/www/app/.env
    #  - .:/var/www/app
    environment:
      - APP_ENV=${APP_ENV:-prod}
      - DATABASE_HOST=${DATABASE_HOST:-db}
      - DATABASE_PORT=${DATABASE_PORT:-5432}
      - REDIS_HOST=${REDIS_HOST:-redis}
      - REDIS_PORT=${REDIS_PORT:-6379}
    links:
      - db
      - redis
      - relatorio
      - logstash:gelf

  nginx:
    build:
      context: .
      dockerfile: docker/nginx/Dockerfile
    image: ${IMAGE_NGINX-chill_nginx}:${VERSION:-latest}
    #
    # normally, you should not mount any volume and use your own image
    #
    #volumes:
    #  - .:/var/www/app
    #  - ./docker/nginx/conf.d/default.conf:/etc/nginx/default.conf
    links:
      - php
    ports:
      - "8001:80"

  db:
    image: postgis/postgis:12-3.1-alpine
    volumes:
      - ./docker/db/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    ports:
      - "127.0.0.1:5432:5432"
    environment:
      - "POSTGRES_PASSWORD=${DATABASE_PASSWORD}"

  redis:
    image: redis

  relatorio:
    image: registry.gitlab.com/champs-libres/public/relatorio-tornado/app:latest

  logstash:
    build:
      context: ./docker/logstash