Dockerfile-base 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # --------------------------------------------------
  2. # Overleaf Base Image (sharelatex/sharelatex-base)
  3. # --------------------------------------------------
  4. FROM phusion/baseimage:noble-1.0.2
  5. # Makes sure LuaTex cache is writable
  6. # -----------------------------------
  7. ENV TEXMFVAR=/var/lib/overleaf/tmp/texmf-var
  8. # Update to ensure dependencies are updated
  9. # ------------------------------------------
  10. ENV REBUILT_AFTER="2026-01-13"
  11. # Install dependencies
  12. # --------------------
  13. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  14. # Technically, we are using potentially stale package-lists with the below line.
  15. # Practically, apt refreshes the lists as needed and release builds run in fresh CI VMs without the cache.
  16. --mount=type=cache,target=/var/lib/apt/lists,sharing=locked true \
  17. # Enable caching: https://docs.docker.com/reference/dockerfile/#example-cache-apt-packages
  18. && rm -f /etc/apt/apt.conf.d/docker-clean && echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache \
  19. && apt-get update \
  20. && apt-get install -y \
  21. unattended-upgrades \
  22. build-essential wget net-tools unzip time imagemagick optipng strace nginx git python3 python-is-python3 zlib1g-dev libpcre3-dev gettext-base libwww-perl ca-certificates curl gnupg \
  23. qpdf \
  24. # upgrade base-image, batch all the upgrades together, rather than installing them on-by-one (which is slow!)
  25. && unattended-upgrade --verbose --no-minimal-upgrade-steps \
  26. # install Node.js https://github.com/nodesource/distributions#nodejs
  27. && mkdir -p /etc/apt/keyrings \
  28. && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
  29. && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
  30. && apt-get update \
  31. && apt-get install -y nodejs \
  32. \
  33. && rm -rf \
  34. # We are adding a custom nginx config in the main Dockerfile.
  35. /etc/nginx/nginx.conf \
  36. /etc/nginx/sites-enabled/default
  37. # Install TexLive
  38. # ---------------
  39. # CTAN mirrors occasionally fail, in that case install TexLive using a
  40. # different server, for example https://ctan.crest.fr
  41. #
  42. # # docker build \
  43. # --build-arg TEXLIVE_MIRROR=https://ctan.crest.fr/tex-archive/systems/texlive/tlnet \
  44. # -f Dockerfile-base -t sharelatex/sharelatex-base .
  45. ARG TEXLIVE_MIRROR=https://mirror.ox.ac.uk/sites/ctan.org/systems/texlive/tlnet
  46. RUN mkdir /install-tl-unx \
  47. && wget --quiet https://tug.org/texlive/files/texlive.asc \
  48. && gpg --import texlive.asc \
  49. && rm texlive.asc \
  50. && wget --quiet ${TEXLIVE_MIRROR}/install-tl-unx.tar.gz \
  51. && wget --quiet ${TEXLIVE_MIRROR}/install-tl-unx.tar.gz.sha512 \
  52. && wget --quiet ${TEXLIVE_MIRROR}/install-tl-unx.tar.gz.sha512.asc \
  53. && gpg --verify install-tl-unx.tar.gz.sha512.asc \
  54. && sha512sum -c install-tl-unx.tar.gz.sha512 \
  55. && tar -xz -C /install-tl-unx --strip-components=1 -f install-tl-unx.tar.gz \
  56. && rm install-tl-unx.tar.gz* \
  57. && echo "tlpdbopt_autobackup 0" >> /install-tl-unx/texlive.profile \
  58. && echo "tlpdbopt_install_docfiles 0" >> /install-tl-unx/texlive.profile \
  59. && echo "tlpdbopt_install_srcfiles 0" >> /install-tl-unx/texlive.profile \
  60. && echo "selected_scheme scheme-basic" >> /install-tl-unx/texlive.profile \
  61. \
  62. && /install-tl-unx/install-tl \
  63. -profile /install-tl-unx/texlive.profile \
  64. -repository ${TEXLIVE_MIRROR} \
  65. \
  66. && $(find /usr/local/texlive -name tlmgr) path add \
  67. && tlmgr install --repository ${TEXLIVE_MIRROR} \
  68. latexmk \
  69. texcount \
  70. synctex \
  71. etoolbox \
  72. xetex \
  73. && tlmgr path add \
  74. && rm -rf /install-tl-unx
  75. # Set up overleaf user and home directory
  76. # -----------------------------------------
  77. RUN adduser --system --group --home /overleaf --no-create-home overleaf && \
  78. mkdir -p /var/lib/overleaf && \
  79. chown www-data:www-data /var/lib/overleaf && \
  80. mkdir -p /var/log/overleaf && \
  81. chown www-data:www-data /var/log/overleaf && \
  82. mkdir -p /var/lib/overleaf/data/template_files && \
  83. chown www-data:www-data /var/lib/overleaf/data/template_files