Dockerfile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 for npm install
  8. # -----------------------------------------
  9. COPY --parents libraries/*/package.json patches/ services/*/package.json tools/migrations/ package.json package-lock.json /overleaf/
  10. COPY server-ce/genScript.js server-ce/services.js /overleaf/
  11. # Install npm dependencies
  12. # ------------------------
  13. RUN --mount=type=cache,target=/root/.cache \
  14. --mount=type=cache,target=/root/.npm \
  15. --mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \
  16. --mount=type=tmpfs,target=/tmp node genScript install | bash
  17. # Add the actual source files
  18. # ---------------------------
  19. COPY --parents libraries/ services/ tools/migrations/ /overleaf/
  20. RUN --mount=type=cache,target=/root/.cache \
  21. --mount=type=cache,target=/root/.npm \
  22. --mount=type=cache,target=/overleaf/services/web/node_modules/.cache,id=server-ce-webpack-cache \
  23. --mount=type=tmpfs,target=/tmp node genScript compile | bash
  24. # Copy runit service startup scripts to its location
  25. # --------------------------------------------------
  26. ADD server-ce/runit /etc/service
  27. # Copy runit global settings to its location
  28. # ------------------------------------------
  29. ADD server-ce/config/env.sh /etc/overleaf/env.sh
  30. # Configure nginx
  31. # ---------------
  32. ADD server-ce/nginx/nginx.conf.template /etc/nginx/templates/nginx.conf.template
  33. ADD server-ce/nginx/overleaf.conf /etc/nginx/sites-enabled/overleaf.conf
  34. ADD server-ce/nginx/clsi-nginx.conf /etc/nginx/sites-enabled/clsi-nginx.conf
  35. # Configure log rotation
  36. # ----------------------
  37. ADD server-ce/logrotate/overleaf /etc/logrotate.d/overleaf
  38. RUN chmod 644 /etc/logrotate.d/overleaf
  39. # Configure cron tasks
  40. # ----------------------
  41. ADD server-ce/cron /overleaf/cron
  42. ADD server-ce/config/crontab-history /etc/cron.d/crontab-history
  43. RUN chmod 600 /etc/cron.d/crontab-history
  44. ADD server-ce/config/crontab-deletion /etc/cron.d/crontab-deletion
  45. RUN chmod 600 /etc/cron.d/crontab-deletion
  46. # Copy Phusion Image startup and shutdown scripts to their locations
  47. # ------------------------------------------------------------------
  48. COPY server-ce/init_scripts/ /etc/my_init.d/
  49. COPY server-ce/init_preshutdown_scripts/ /etc/my_init.pre_shutdown.d/
  50. # Copy app settings files
  51. # -----------------------
  52. COPY server-ce/config/settings.js /etc/overleaf/settings.js
  53. # Copy history-v1 files
  54. # -----------------------
  55. COPY server-ce/config/production.json /overleaf/services/history-v1/config/production.json
  56. COPY server-ce/config/custom-environment-variables.json /overleaf/services/history-v1/config/custom-environment-variables.json
  57. # Copy grunt thin wrapper
  58. # -----------------------
  59. ADD server-ce/bin/grunt /usr/local/bin/grunt
  60. RUN chmod +x /usr/local/bin/grunt
  61. # Copy history helper scripts
  62. # ---------------------------
  63. ADD server-ce/bin/flush-history-queues /overleaf/bin/flush-history-queues
  64. RUN chmod +x /overleaf/bin/flush-history-queues
  65. ADD server-ce/bin/force-history-resyncs /overleaf/bin/force-history-resyncs
  66. RUN chmod +x /overleaf/bin/force-history-resyncs
  67. # Copy Latexmkrc
  68. # -----------------------
  69. COPY server-ce/config/latexmkrc /usr/local/share/latexmk/LatexMk
  70. # File that controls open|closed status of the site
  71. # -------------------------------------------------
  72. ENV SITE_MAINTENANCE_FILE="/etc/overleaf/site_status"
  73. RUN touch $SITE_MAINTENANCE_FILE
  74. # Set Environment Variables
  75. # --------------------------------
  76. ENV OVERLEAF_CONFIG=/etc/overleaf/settings.js
  77. ENV WEB_API_USER="overleaf"
  78. ENV ADMIN_PRIVILEGE_AVAILABLE="true"
  79. ENV OVERLEAF_APP_NAME="Overleaf Community Edition"
  80. ENV OPTIMISE_PDF="true"
  81. # Phusion Image timeouts before sending SIGKILL to processes
  82. # ----------------------------------------------------------
  83. ENV KILL_PROCESS_TIMEOUT=55
  84. ENV KILL_ALL_PROCESSES_TIMEOUT=55
  85. ENV GRACEFUL_SHUTDOWN_DELAY_SECONDS=1
  86. ENV NODE_ENV="production"
  87. ENV LOG_LEVEL="info"
  88. EXPOSE 80
  89. ENTRYPOINT ["/sbin/my_init"]