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. ENV CYPRESS_INSTALL_BINARY=0
  20. RUN node genScript install | bash
  21. # Compile
  22. # --------------------
  23. RUN 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. # File that controls open|closed status of the site
  68. # -------------------------------------------------
  69. ENV SITE_MAINTENANCE_FILE "/etc/overleaf/site_status"
  70. RUN touch $SITE_MAINTENANCE_FILE
  71. # Set Environment Variables
  72. # --------------------------------
  73. ENV OVERLEAF_CONFIG /etc/overleaf/settings.js
  74. ENV WEB_API_USER "overleaf"
  75. ENV ADMIN_PRIVILEGE_AVAILABLE "true"
  76. ENV OVERLEAF_APP_NAME "Overleaf Community Edition"
  77. ENV OPTIMISE_PDF "true"
  78. # Phusion Image timeouts before sending SIGKILL to processes
  79. # ----------------------------------------------------------
  80. ENV KILL_PROCESS_TIMEOUT 55
  81. ENV KILL_ALL_PROCESSES_TIMEOUT 55
  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