services:
  gemini:
    image: git.joeac.net/joeac/${IMAGE_PREFIX}joeac.net-gemini
    container_name: joeac.net-gemini
    build:
      context: .
      dockerfile: gemini.Dockerfile
    ports:
      - "${GEMINI_PORT}:1965"
    volumes:
      - ${GEMINI_CERTIFICATES_DIR}:/var/app/.certificates
      - ${GEMINI_COMITIUM_DATA_DIR}:/var/app/comitium-data

  http:
    image: git.joeac.net/joeac/${IMAGE_PREFIX}joeac.net-http
    container_name: joeac.net-http
    build:
      context: .
      dockerfile: http.Dockerfile
    environment:
      MAX_DAILY_EMAILS: ${MAX_DAILY_EMAILS}
      CONTACT_MAILBOX: ${CONTACT_MAILBOX}
      CONTACT_MAILBOX_NAME: ${CONTACT_MAILBOX_NAME}
      LOCAL_SMTP_FROM: ${LOCAL_SMTP_FROM}
      LOCAL_SMTP_FROM_NAME: ${LOCAL_SMTP_FROM_NAME}
      LOCAL_SMTP_HOST: ${LOCAL_SMTP_HOST}
      LOCAL_SMTP_PORT: ${LOCAL_SMTP_PORT}
      LOCAL_SMTP_USER: ${LOCAL_SMTP_USER}
      LOCAL_SMTP_PASSWORD: ${LOCAL_SMTP_PASSWORD}
      DB_SCHEME: ${DB_SCHEME}
      DB_PATH: ${DB_PATH}
    ports:
      - "${HTTP_PORT}:80"

  etherpad:
    image: git.joeac.net/joeac/${IMAGE_PREFIX}joeac.net-etherpad
    container_name: joeac.net-etherpad
    build:
      context: .
      dockerfile: etherpad.Dockerfile
      args:
        ALPINE_VERSION: ${ALPINE_VERSION}
        ETHERPAD_VERSION: ${ETHERPAD_VERSION}
    volumes:
      - ${ETHERPAD_DATA_DIR}:/var/app/var
    environment:
      NODE_ENV: ${ETHERPAD_NODE_ENV}
      ADMIN_PASSWORD: ${ETHERPAD_ADMIN_PASSWORD}
    restart: unless-stopped
    ports:
      - "${ETHERPAD_PORT}:9001"

  smtp:
    image: git.joeac.net/joeac/${IMAGE_PREFIX}joeac.net-smtp
    container_name: joeac.net-smtp
    build:
      context: .
      dockerfile: smtp.Dockerfile
      args:
        SMTP_PORT: ${LOCAL_SMTP_PORT}
    environment:
      LOCAL_SMTP_ENVELOPE_FROM: ${LOCAL_SMTP_ENVELOPE_FROM}
      REMOTE_SMTP_HOST: ${REMOTE_SMTP_HOST}
      REMOTE_SMTP_PORT: ${REMOTE_SMTP_PORT}
      REMOTE_SMTP_USER: ${REMOTE_SMTP_USER}
      SMTP_PORT: ${LOCAL_SMTP_PORT}
      SMTP_USER: ${LOCAL_SMTP_USER}
      SMTP_PASSWORD: ${LOCAL_SMTP_PASSWORD}
      REMOTE_SMTP_PASSWORD_FILE: /run/secrets/remote_smtp_password
    secrets:
      - remote_smtp_password

  vaultwarden:
    image: docker.io/vaultwarden/server:latest
    container_name: joeac.net-vaultwarden
    restart: unless-stopped
    environment:
      DOMAIN: "https://pwd.joeac.net"
    volumes:
      - ${VAULTWARDEN_DATA_DIR}:/data/
    ports:
      - "${VAULTWARDEN_PORT}:80"

secrets:
  remote_smtp_password:
    external: true
