version: "3.8"
services:
  app:
    user: "0:0"
    image: etherpad/etherpad:latest
    tty: true
    stdin_open: true
    volumes:
      - ../files/plugins:/opt/etherpad-lite/src/plugin_packages
      - ../files/etherpad_var:/opt/etherpad-lite/var
    depends_on:
      - postgres
    environment:
      NODE_ENV: ${NODE_ENV}
      ADMIN_PASSWORD: ${ADMIN_PASSWORD}
      DB_CHARSET: ${DB_CHARSET}
      DB_HOST: ${DB_HOST}
      DB_NAME: ${DB_NAME}
      DB_PASS: ${DB_PASS}
      DB_PORT: ${DB_PORT}
      DB_TYPE: ${DB_TYPE}
      DB_USER: ${DB_USER}
      DEFAULT_PAD_TEXT: ${DEFAULT_PAD_TEXT}
      DISABLE_IP_LOGGING: ${DISABLE_IP_LOGGING}
      SOFFICE: ${SOFFICE}
      TRUST_PROXY: ${TRUST_PROXY}
    restart: always
    expose:
      - 9001
  postgres:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_USER: ${POSTGRES_USER}
      PGDATA: /var/lib/postgresql/data/pgdata
    restart: always
    volumes:
      - ../files/postgres_data:/var/lib/postgresql/data/pgdata
