version: "3"

services:
  server:
    build:
      context: ./Backend
    ports:
      - "8080:8080"
    volumes:
      - "./Backend:/go/src/git.tovijaeschke.xyz/Capsule/Backend"
    links:
      - postgres
      - postgres-testing
    depends_on:
      postgres:
        condition: service_healthy
    depends_on:
      postgres-testing:
        condition: service_healthy
  postgres:
    image: postgres:14.5
    ports:
      - "54321:5432"
    environment:
      POSTGRES_DB: capsule
      POSTGRES_PASSWORD: password
    volumes:
      - /var/lib/postgres
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5
  postgres-testing:
    image: postgres:14.5
    ports:
      - "54322:5432"
    environment:
      POSTGRES_DB: capsule-testing
      POSTGRES_PASSWORD: password
    tmpfs:
      - /var/lib/mysql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5


