FROM node:10-buster-slim as base LABEL maintainer="quentinduchemin@tuta.io" ENV NODE_ENV=production FROM base as downloader ARG ETHERPAD_VERSION_BUILD=1.8.3 ARG ETHERPAD_PLUGINS="\ ep_align ep_author_hover ep_chatdate ep_colibris_full_width \ ep_comments_page ep_countable ep_delete_empty_pads ep_font_color \ ep_font_family ep_headings2 ep_markdown ep_pad_activity_nofication_in_title \ ep_pads_stats ep_page_view ep_prompt_for_name ep_set_title_on_pad \ ep_subscript_and_superscript ep_tables3 ep_user_font_size" RUN apt-get update && \ apt-get install -y \ curl \ gzip \ jpegoptim \ libssl-dev \ optipng \ pkg-config \ python \ unzip && \ mkdir -p /opt/etherpad-lite WORKDIR /opt/etherpad-lite # Install Etherpad RUN curl -SL https://github.com/ether/etherpad-lite/archive/${ETHERPAD_VERSION_BUILD}.zip > etherpad.zip && \ unzip etherpad && \ rm -Rf etherpad.zip etherpad-lite-${ETHERPAD_VERSION_BUILD}/.git && \ mv etherpad-lite-${ETHERPAD_VERSION_BUILD}/* . && \ bin/installDeps.sh && \ # Build and replace landing page RUN npm install minify && \ /builds/$CI_PROJECT_PATH/landing-page/build/build.sh && \ cp /builds/$CI_PROJECT_PATH/landing-page/index.html src/templates/index.html && \ cp -r /builds/$CI_PROJECT_PATH/landing-page/static/* src/static/ # Install plugins 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 # Construction de l'image finale FROM base # Try to stick to the LDAP UID for etherpad (OU=services) ARG UID=5004 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 --chown=etherpad /opt/etherpad-lite /opt/etherpad-lite/ RUN apt-get update && \ apt-get install -y curl default-mysql-client && \ chmod +x /opt/etherpad-lite/entrypoint.sh && \ usermod -d /opt/etherpad-lite etherpad && \ chown -R etherpad /opt/etherpad-lite && \ rm -rf /var/lib/apt/lists/* EXPOSE 8080 HEALTHCHECK 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" ]