Dockerfile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # ---------------------------------------------
  2. # Overleaf Community Edition (overleaf/overleaf)
  3. # ---------------------------------------------
  4. ARG OVERLEAF_BASE_TAG=sharelatex/sharelatex-base:latest
  5. FROM $OVERLEAF_BASE_TAG
  6. WORKDIR /overleaf
  7. # Add required source files
  8. # -------------------------
  9. COPY libraries/ /overleaf/libraries/
  10. COPY services/ /overleaf/services/
  11. COPY tools/migrations/ /overleaf/tools/migrations/
  12. COPY .yarn/patches/ /overleaf/.yarn/patches/
  13. COPY package.json yarn.lock .yarnrc.yml /overleaf/
  14. COPY server-ce/genScript.js server-ce/services.js /overleaf/
  15. # Pre-install yarn via corepack so it is available at runtime for all users
  16. # -------------------------------------------------------------------------
  17. # Corepack setup, shared between all the images.
  18. ENV PATH="/overleaf/node_modules/.bin:$PATH"
  19. ENV COREPACK_HOME=/opt/corepack
  20. RUN corepack enable && corepack install -g yarn@4.14.1
  21. ENV COREPACK_ENABLE_NETWORK=0
  22. # Install yarn dependencies
  23. # -------------------------
  24. RUN node genScript install | bash
  25. # Compile the source files
  26. # ------------------------
  27. RUN node genScript compile | bash
  28. # Copy runit service startup scripts to its location
  29. # --------------------------------------------------
  30. ADD server-ce/runit /etc/service
  31. # Copy runit global settings to its location
  32. # ------------------------------------------
  33. ADD server-ce/config/env.sh /etc/overleaf/env.sh
  34. # Configure nginx
  35. # ---------------
  36. ADD server-ce/nginx/nginx.conf.template /etc/nginx/templates/nginx.conf.template
  37. ADD server-ce/nginx/overleaf.conf /etc/nginx/sites-enabled/overleaf.conf
  38. ADD server-ce/nginx/clsi-nginx.conf /etc/nginx/sites-enabled/clsi-nginx.conf
  39. # Configure log rotation
  40. # ----------------------
  41. ADD server-ce/logrotate/overleaf /etc/logrotate.d/overleaf
  42. RUN chmod 644 /etc/logrotate.d/overleaf
  43. # Configure cron tasks
  44. # ----------------------
  45. ADD server-ce/cron /overleaf/cron
  46. ADD server-ce/config/crontab-history /etc/cron.d/crontab-history
  47. RUN chmod 600 /etc/cron.d/crontab-history
  48. ADD server-ce/config/crontab-deletion /etc/cron.d/crontab-deletion
  49. RUN chmod 600 /etc/cron.d/crontab-deletion
  50. # Copy Phusion Image startup and shutdown scripts to their locations
  51. # ------------------------------------------------------------------
  52. COPY server-ce/init_scripts/ /etc/my_init.d/
  53. COPY server-ce/init_preshutdown_scripts/ /etc/my_init.pre_shutdown.d/
  54. # Copy app settings files
  55. # -----------------------
  56. COPY server-ce/config/settings.js /etc/overleaf/settings.js
  57. # Copy history-v1 files
  58. # -----------------------
  59. COPY server-ce/config/production.json /overleaf/services/history-v1/config/production.json
  60. COPY server-ce/config/custom-environment-variables.json /overleaf/services/history-v1/config/custom-environment-variables.json
  61. # Copy grunt thin wrapper
  62. # -----------------------
  63. ADD server-ce/bin/grunt /usr/local/bin/grunt
  64. RUN chmod +x /usr/local/bin/grunt
  65. # Copy history helper scripts
  66. # ---------------------------
  67. ADD server-ce/bin/flush-history-queues /overleaf/bin/flush-history-queues
  68. RUN chmod +x /overleaf/bin/flush-history-queues
  69. ADD server-ce/bin/force-history-resyncs /overleaf/bin/force-history-resyncs
  70. RUN chmod +x /overleaf/bin/force-history-resyncs
  71. # Copy Latexmkrc
  72. # -----------------------
  73. COPY server-ce/config/latexmkrc /usr/local/share/latexmk/LatexMk
  74. # File that controls open|closed status of the site
  75. # -------------------------------------------------
  76. ENV SITE_MAINTENANCE_FILE="/etc/overleaf/site_status"
  77. RUN touch $SITE_MAINTENANCE_FILE
  78. # Set Environment Variables
  79. # --------------------------------
  80. ENV OVERLEAF_CONFIG=/etc/overleaf/settings.js
  81. ENV WEB_API_USER="overleaf"
  82. ENV ADMIN_PRIVILEGE_AVAILABLE="true"
  83. ENV OVERLEAF_APP_NAME="Overleaf Community Edition"
  84. ENV OPTIMISE_PDF="true"
  85. # Phusion Image timeouts before sending SIGKILL to processes
  86. # ----------------------------------------------------------
  87. ENV KILL_PROCESS_TIMEOUT=55
  88. ENV KILL_ALL_PROCESSES_TIMEOUT=55
  89. ENV GRACEFUL_SHUTDOWN_DELAY_SECONDS=1
  90. ENV NODE_ENV="production"
  91. ENV LOG_LEVEL="info"
  92. EXPOSE 80
  93. ENTRYPOINT ["/sbin/my_init"]