services:
  postgres:
    image: postgres:15-alpine
    container_name: jomblo-postgres
    restart: unless-stopped
    ports:
      - "5435:5432" # Port 5435 to avoid conflicts with existing PostgreSQL installations
    environment:
      POSTGRES_DB: ${DATABASE_NAME}
      POSTGRES_USER: ${DATABASE_USER}
      POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./migrations:/docker-entrypoint-initdb.d:Z
    networks:
      - jomblo-network

  redis:
    image: redis/redis-stack-server:latest
    container_name: jomblo-redis
    restart: unless-stopped
    ports:
      - "6380:6379" # Port 6380 to avoid conflicts
    volumes:
      - redis_data:/data
    networks:
      - jomblo-network

  pgadmin:
    image: dpage/pgadmin4
    container_name: jomblo-pgadmin
    restart: unless-stopped
    ports:
      - "5050:80"
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD}
    volumes:
      - pgadmin_data:/var/lib/pgadmin
    networks:
      - jomblo-network
    depends_on:
      - postgres

volumes:
  postgres_data:
  redis_data:
  pgadmin_data:

networks:
  jomblo-network:
    driver: bridge
