docker-compose.yml

Summary

Maintainability
Test Coverage
services:
  ####################### React App #######################
  pims-app-v2:
    tty: true
    restart: 'no'
    container_name: pims-app-v2
    build:
      context: react-app
      target: prod
    ports:
      - ${APP_HTTP_PORT:-3000}:3000
    depends_on:
      - pims-api-v2
    env_file: .env
    networks:
      - pims
  
  ####################### Express API #######################
  pims-api-v2:
    restart: 'no'
    container_name: pims-api-v2
    build:
      context: express-api
      target: Prod
    env_file:
      - .env
    ports:
      - ${API_HTTP_PORT:-5000}:5000
    depends_on:
      - postgres
    healthcheck:
      test: ['CMD', 'curl', '-f', 'http://localhost:5000/api/v2/health']
      interval: 300s
      timeout: 10s
      retries: 3
    networks:
      - pims

  ####################### Postgres #######################
  postgres:
    container_name: postgres
    image: postgres:15.7
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
    volumes:
      - ./database/postgres/data/db:/data/db
    ports:
      - '${POSTGRES_PORT:-5432}:5432'
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER} || exit 1']
      interval: 5s
      timeout: 3s
    networks:
      - pims

####################### Networks Definition #######################
networks:
  pims:
    name: pims-net
    driver: bridge