version: '3.9'

services:
  nginx:
    build:
      context: .docker/nginx
      dockerfile: Dockerfile
    ports:
      - '8888:80'
    volumes:
      - .:/var/www/html
      - .docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    networks:
      - connect-sens-network

  php:
    image: php:8.2-fpm
    expose:
      - '9000'
    volumes:
      - .:/var/www/html/
    networks:
      - connect-sens-network

  db:
    image: postgres:${POSTGRES_VERSION:-15}-alpine
    ports:
      - '5454:5432'
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-connect_sens_db}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
      POSTGRES_USER: ${POSTGRES_USER:-app}
    volumes:
      - database_data:/var/lib/postgresql/data:rw
    networks:
      - connect-sens-network

  portainer:
    container_name: portainer
    image: portainer/portainer:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data
    ports:
      - "9001:9000"

volumes:
  database_data:
  portainer_data:

networks:
    connect-sens-network:
      external: true

