version: '3'

services:
  postgres:
    image: postgres:12
    environment:
      POSTGRES_DB: dna_analyser
      POSTGRES_USER: ${POSTGRES_USER:-developer}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password}
      PGDATA: /data/postgres
    volumes:
      - postgres:/data/postgres
    ports:
      - 5432:5432
  pgadmin:
    image: dpage/pgadmin4
    depends_on:
      - postgres
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-password}
    volumes:
      - pgadmin:/root/.pgadmin
    ports:
      - 5050:80

  adminer:
    image: adminer
    depends_on:
      - postgres
    environment:
      ADMINER_DEFAULT_SERVER: postgres
    ports:
      - 5000:8080

  backend:
    build: .
    image: backend
    ports:
      - "80:80"
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/dna_analyser
      - SPRING_DATASOURCE_USERNAME=developer
      - SPRING_DATASOURCE_PASSWORD=password
    depends_on:
      - postgres

volumes:
  postgres:
  pgadmin:
