Skip to content
Snippets Groups Projects
Dockerfile 2.66 KiB
Newer Older
FROM node:10-buster-slim as base
LABEL maintainer="quentinduchemin@tuta.io"
Igor Witz's avatar
Igor Witz committed

ENV NODE_ENV=production

FROM base as downloader

ARG ETHERPAD_VERSION_BUILD=1.8.6
ARG ETHERPAD_PLUGINS="\
  ep_adminpads2 ep_align ep_author_hover ep_back_button ep_chatdate \
  ep_comments_page ep_delete_after_delay ep_delete_empty_pads ep_font_color \
  ep_font_family ep_headings2 ep_markdown ep_message_all ep_pad_activity_nofication_in_title \
  ep_pads_stats ep_prompt_for_name ep_set_title_on_pad \
  ep_subscript_and_superscript"
Igor Witz's avatar
Igor Witz committed

RUN apt-get update && \
    apt-get install -y \
      curl \
      libssl-dev \
      pkg-config \
    mkdir -p /opt/etherpad-lite/
Quentin Duchemin's avatar
Quentin Duchemin committed
RUN curl -SL https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION_BUILD}.zip > etherpad.zip && \
Antoine Barbare's avatar
Antoine Barbare committed
    unzip etherpad && \
Quentin Duchemin's avatar
Quentin Duchemin committed
    rm -Rf etherpad.zip etherpad-lite-${ETHERPAD_VERSION_BUILD}/.git && \
    mv etherpad-lite-${ETHERPAD_VERSION_BUILD}/* . && \
    bin/installDeps.sh

COPY ./landing-page ./src/templates/landing-page
Igor Witz's avatar
Igor Witz committed

# Build and replace landing page
RUN npm install minify && \
    ./src/templates/landing-page/build/build.sh && \
    cp ./src/templates/landing-page/index.html src/templates/index.html && \
    cp -r ./src/templates/landing-page/static/* src/static/
RUN for PLUGIN_NAME in ${ETHERPAD_PLUGINS}; do npm install "${PLUGIN_NAME}"; done && \
  # Change default hard-coded pad title
  sed -i 's|Untitled Pad|Nouveau pad|g' node_modules/ep_set_title_on_pad/templates/title.ejs && \
  sed -i 's|Untitled Pad|Nouveau pad|g' node_modules/ep_set_title_on_pad/static/tests/frontend/specs/atest.js
Igor Witz's avatar
Igor Witz committed

# Construction de l'image finale
Igor Witz's avatar
Igor Witz committed
FROM base

# Try to stick to the LDAP UID for etherpad (OU=services)
Igor Witz's avatar
Igor Witz committed
COPY entrypoint.sh /opt/etherpad-lite/entrypoint.sh
RUN useradd --uid ${UID} --create-home etherpad

# Import des fichiers téléchargés dans l'image downloader
COPY --from=downloader /opt/etherpad-lite /opt/etherpad-lite/
RUN chown -R etherpad /opt/etherpad-lite
RUN apt-get update && \
    apt-get install -y curl nano postgresql-client && \
Igor Witz's avatar
Igor Witz committed
    chmod +x /opt/etherpad-lite/entrypoint.sh && \
    usermod -d /opt/etherpad-lite etherpad && \
    chown -R etherpad /opt/etherpad-lite && \
Rémy Huet's avatar
Rémy Huet committed
    rm -rf /var/lib/apt/lists/*
Igor Witz's avatar
Igor Witz committed

RUN mkdir /opt/etherpad-lite/deleted_pads && \
    chown -R etherpad:etherpad /opt/etherpad-lite/deleted_pads

HEALTHCHECK --interval=20s --timeout=3s CMD curl --fail http://localhost:8080 || exit 1
WORKDIR /opt/etherpad-lite/
USER etherpad
ENTRYPOINT ["/opt/etherpad-lite/entrypoint.sh"]
CMD [ "/bin/bash", "-c", "/opt/etherpad-lite/bin/run.sh" ]