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