Dockerfile 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # ---------------------------------------------
  2. # Overleaf Community Edition (overleaf/overleaf)
  3. # ---------------------------------------------
  4. FROM sharelatex/sharelatex-base:latest
  5. ENV SHARELATEX_CONFIG /etc/sharelatex/settings.coffee
  6. # Checkout Overleaf Community Edition repo
  7. # ----------------------------------------
  8. RUN git clone https://github.com/overleaf/overleaf.git \
  9. --depth 1 /var/www/sharelatex
  10. # Copy build dependencies
  11. # -----------------------
  12. ADD ${baseDir}/git-revision.sh /var/www/git-revision.sh
  13. ADD ${baseDir}/services.js /var/www/sharelatex/config/services.js
  14. # Checkout services
  15. # -----------------
  16. RUN cd /var/www/sharelatex \
  17. && npm install \
  18. && grunt install \
  19. \
  20. # Cleanup not needed artifacts
  21. # ----------------------------
  22. && rm -rf /root/.cache /root/.npm $(find /tmp/ -mindepth 1 -maxdepth 1) \
  23. # Stores the version installed for each service
  24. # ---------------------------------------------
  25. && cd /var/www \
  26. && ./git-revision.sh > revisions.txt \
  27. \
  28. # Cleanup the git history
  29. # -------------------
  30. && rm -rf $(find /var/www/sharelatex -name .git)
  31. # Install npm dependencies
  32. # ------------------------
  33. RUN cd /var/www/sharelatex \
  34. && bash ./bin/install-services \
  35. \
  36. # Cleanup not needed artifacts
  37. # ----------------------------
  38. && rm -rf /root/.cache /root/.npm $(find /tmp/ -mindepth 1 -maxdepth 1)
  39. # Compile CoffeeScript
  40. # --------------------
  41. RUN cd /var/www/sharelatex \
  42. && bash ./bin/compile-services
  43. # Links CLSI sycntex to its default location
  44. # ------------------------------------------
  45. RUN ln -s /var/www/sharelatex/clsi/bin/synctex /opt/synctex
  46. # Copy runit service startup scripts to its location
  47. # --------------------------------------------------
  48. ADD ${baseDir}/runit /etc/service
  49. # Configure nginx
  50. # ---------------
  51. ADD ${baseDir}/nginx/nginx.conf /etc/nginx/nginx.conf
  52. ADD ${baseDir}/nginx/sharelatex.conf /etc/nginx/sites-enabled/sharelatex.conf
  53. # Configure log rotation
  54. # ----------------------
  55. ADD ${baseDir}/logrotate/sharelatex /etc/logrotate.d/sharelatex
  56. # Copy Phusion Image startup scripts to its location
  57. # --------------------------------------------------
  58. COPY ${baseDir}/init_scripts/ /etc/my_init.d/
  59. # Copy app settings files
  60. # -----------------------
  61. COPY ${baseDir}/settings.coffee /etc/sharelatex/settings.coffee
  62. # Set Environment Variables
  63. # --------------------------------
  64. ENV WEB_API_USER "sharelatex"
  65. ENV SHARELATEX_APP_NAME "Overleaf Community Edition"
  66. EXPOSE 80
  67. WORKDIR /
  68. ENTRYPOINT ["/sbin/my_init"]