version: "3.4"

# Production environment override
services:
  php:
    build:
      context: ./api
      target: php_prod
    environment:
      APP_SECRET: ${APP_SECRET}
      MERCURE_JWT_SECRET: ${CADDY_MERCURE_JWT_SECRET}

  front:
     build:
      context: ./front
      target: prod

  caddy:
    build:
      context: ./api/
      target: caddy_prod
    environment:
      MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
      MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET}
    ports:
      # HTTP
      - target: 80
        published: ${HTTP_PORT:-8088}
        protocol: tcp


  database:
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}