---

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
      - ${PG_HOST}
    build:
      context: .
      dockerfile: ./development.django.Dockerfile
      args:
        CUSTOM_UID: 1000
        CUSTOM_GID: 1000
    expose:
      - "8000"
    volumes:
      - ./app/authentication/:/app/authentication:ro
      - ./app/core/:/app/core:ro
      - ./app/gotify/:/app/gotify:ro
      - ./app/manage.py:/app/manage.py:ro
      - ./app/medwings/:/app/medwings:ro
      - ./app/requirements.txt:/app/requirements.txt:ro
      - ./app/static/:/app/static:ro
      - ./app/withings/:/app/withings:ro
    environment:
      TZ: ${TIMEZONE}
      PG_NAME: ${PG_NAME}
      PG_USER: ${PG_USER}
      PG_PASSWORD: ${PG_PASSWORD}
      PG_HOST: ${PG_HOST}
      PG_PORT: ${PG_PORT}
      WITHINGS_CLIENT_ID: ${WITHINGS_CLIENT_ID}
      WITHINGS_CLIENT_SECRET: ${WITHINGS_CLIENT_SECRET}
      GOTIFY_USER: ${GOTIFY_USER}
      GOTIFY_PASSWORD: ${GOTIFY_PASSWORD}
      GOTIFY_HOST: ${GOTIFY_HOST}
      GOTIFY_PUBLIC_URL: ${GOTIFY_PUBLIC_URL}
  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-gotify:
    image: gotify/server
    container_name: medwings-gotify
    restart: unless-stopped
    ports:
      - "8001:80"
    volumes:
      - ./.gotify:/app/data
    environment:
      TZ: ${TIMEZONE}
      GOTIFY_SERVER_SSL_REDIRECTTOHTTPS: false
      GOTIFY_DEFAULTUSER_NAME: ${GOTIFY_USER}
      GOTIFY_DEFAULTUSER_PASS: ${GOTIFY_PASSWORD}
      GOTIFY_SERVER_CORS_ALLOWORIGINS: "- \"localhost:8000\"\n- \"medwings.lobbes.dev\""
      GOTIFY_SERVER_CORS_ALLOWMETHODS: "- \"GET\"\n- \"POST\""
      GOTIFY_SERVER_CORS_ALLOWHEADERS: "- \"Authorization\"\n- \"content-type\""
  medwings-pgweb:
    image: sosedoff/pgweb
    container_name: medwings-pgweb
    restart: unless-stopped
    depends_on:
      - ${PG_HOST}
    ports:
      - "8002:8081"
    environment:
      PGWEB_DATABASE_URL: postgres://${PG_USER}:${PG_PASSWORD}@${PG_HOST}:${PG_PORT}/${PG_NAME}?sslmode=disable
      TZ: ${TIMEZONE}

...
