user-service 0.3.1

A user management microservice.
Documentation
version: '3.9'

name: user-service

services:

  ################
  # USER SERVICE #
  ################

  api:
    container_name: user-service-api
    build:
      context: .
      dockerfile: Dockerfile
      args:
        PROFILE: dev # Faster build times for local develpment, this will be automatically changed to release if omitted
    environment:
      DATABASE_URL: postgres://user_service:user_service@user-service-db:5432/user_service
      MAIL_SERVICE_HOST: "http://user-service-mail-service-api:80"
    depends_on:
      db:
        condition: service_healthy
    ports:
      - "127.0.0.1:0:80"
  
  ################
  # MAIL SERVICE #
  ################

  mail-service-api:
    container_name: user-service-mail-service-api
    build:
      context: ../mail-service
      dockerfile: Dockerfile
    environment:
      FLASK_APP: wsgi.py
      SA_CREDS_LOCATION: sa_creds.json
    volumes:
      - ../mail-service:/app
    ports:
      - 127.0.0.1:0:80

  ############
  # DATABASE #
  ############

  db:
    container_name: user-service-db
    restart: always
    build:
      context: database
      dockerfile: Dockerfile.dev
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: admin
    volumes:
      - db-data:/var/lib/postgresql/data
    healthcheck:
      test: "psql -U admin -lqt | cut -d \\| -f 1 | grep -qw user_service" # This check is needed to ensure the user_service database has been created before the api attempts to connect to it
      interval: 250ms
      timeout: 3s
      retries: 40
      start_period: 30s
    ports:
      - "127.0.0.1:0:5432"

  pgadmin:
    container_name: user-service-pgadmin
    image: dpage/pgadmin4:6.21

    environment:
      PGADMIN_DEFAULT_EMAIL: pgadmin@example.com
      PGADMIN_DEFAULT_PASSWORD: pgadminPassword
      PGADMIN_CONFIG_SERVER_MODE: 'False'
      PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False'
    depends_on:
      db:
        condition: service_started
    ports:
      - "127.0.0.1:0:80"

volumes:
  db-data: