version: '3.7'

services:
    nginx:
        build:
            args:
                VERSION: $NGINX_VERSION
            context: .
            dockerfile: ./docker/nginx/Dockerfile
            target: dev
        depends_on:
            - php-fpm
        ports:
            - 8080:80
    php-fpm:
        build:
            args:
                VERSION: $PHP_VERSION
            context: .
            dockerfile: ./docker/php-fpm/Dockerfile
            target: test
        volumes:
            - .:/app
            - ~/etc/timezone:/etc/localtime:ro

        command: sh -c 'composer install --no-interaction --optimize-autoloader && bin/console assets:install && php-fpm'

###> doctrine/doctrine-bundle ###
  database:
    image: postgres:${POSTGRES_VERSION:-14}-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-app}
      # You should definitely change the password in production
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    volumes:
      - db-data:/var/lib/postgresql/data:rw
      # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
      # - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
networks:
    default:
        driver: bridge
volumes:
###> doctrine/doctrine-bundle ###
  db-data:
###< doctrine/doctrine-bundle ###
