#
#   Copyright © 2021,2022 IsardVDI S.L.
#
#   This file is part of DD
#
#   DD is free software: you can redistribute it and/or modify
#   it under the terms of the GNU Affero General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or (at your
#   option) any later version.
#
#   DD is distributed in the hope that it will be useful, but WITHOUT ANY
#   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#   FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
#   details.
#
#   You should have received a copy of the GNU Affero General Public License
#   along with DD. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
version: '3.7'
services:
  dd-apps-etherpad:
    build:
      context: ${BUILD_APPS_ROOT_PATH}/docker/etherpad
      dockerfile: Dockerfile
      args:
        - IMG=${ETHERPAD_IMG-node:16.13.2}
        - ETHERPAD_VERSION=${ETHERPAD_VERSION}
    container_name: dd-apps-etherpad
    restart: unless-stopped
    volumes:
      - /etc/localtime:/etc/localtime:ro
    security_opt:
      - no-new-privileges:true
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9001"]
      interval: 1m30s
      timeout: 10s
      retries: 3
    environment:
      ETHERPAD_TITLE: Title
      ETHERPAD_PORT: 9001
      ETHERPAD_ADMIN_PASSWORD: ${ADMINAPP_PASSWORD}
      ETHERPAD_ADMIN_USER: ${ADMINAPP_USER}
      ETHERPAD_PLUGINS: ep_headings2,ep_adminpads2,ep_comments_page,ep_embedded_hyperlinks2,ep_font_color,ep_table_of_contents
      ETHERPAD_MAXAGE: 3600
      ETHERPAD_DB_USER: ${ETHERPAD_POSTGRES_USER}
      ETHERPAD_DB_PASSWORD: ${ETHERPAD_POSTGRES_PASSWORD}
      ETHERPAD_DB_NAME: etherpad
      ETHERPAD_DB_HOST: dd-apps-postgresql
    networks:
      - dd_net
