Dockerfile 3.7 KB

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