---

version: "3"

services:
  medwings-caddy:
    container_name: medwings-caddy
    restart: unless-stopped
    build:
      context: .
      dockerfile: development.caddy.Dockerfile
      args:
        CUSTOM_UID: 1000
        CUSTOM_GID: 1000
    ports:
      - "8000:8000"
    volumes:
      - ./Caddyfile:/app/Caddyfile
    environment:
      TZ: ${TIMEZONE}
  medwings-django:
    container_name: medwings-django
    restart: unless-stopped
    depends_on:
      - medwings-caddy
      - medwings-postgres
    build:
      context: .
      dockerfile: ./development.django.Dockerfile
      args:
        CUSTOM_UID: 1000
        CUSTOM_GID: 1000
    expose:
      - "8000"
    volumes:
      - ./app/manage.py:/app/manage.py:ro
      - ./app/requirements.txt:/app/requirements.txt:ro
      - ./app/core/:/app/core:ro
      - ./app/medwings/:/app/medwings:ro
      - ./app/static/:/app/static:ro
    environment:
      PG_NAME: ${PG_NAME}
      PG_USER: ${PG_USER}
      PG_PASSWORD: ${PG_PASSWORD}
      PG_HOST: ${PG_HOST}
      PG_PORT: ${PG_PORT}
      TZ: ${TIMEZONE}
  medwings-postgres:
    image: postgres:alpine
    container_name: ${PG_HOST}
    restart: unless-stopped
    expose:
      - ${PG_PORT}
    volumes:
      - ./.postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: ${PG_NAME}
      POSTGRES_USER: ${PG_USER}
      POSTGRES_PASSWORD: ${PG_PASSWORD}
      TZ: ${TIMEZONE}
  medwings-pgweb:
    image: sosedoff/pgweb
    container_name: medwings-pgweb
    restart: unless-stopped
    depends_on:
      - medwings-postgres
    ports:
      - "8001:8081"
    environment:
      PGWEB_DATABASE_URL: postgres://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/${PG_NAME}?sslmode=disable
      TZ: ${TIMEZONE}

...
