Dockerfile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. FROM debian:wheezy-backports
  2. MAINTAINER Gabriele Facciolo <[email protected]>
  3. # Following http://git.27o.de/dataserver/about/Installation-Instructions-for-Debian-Wheezy.md
  4. # debian packages
  5. RUN apt-get update && apt-get install -y \
  6. apache2 libapache2-mod-php5 mysql-server memcached zendframework php5-cli php5-memcached php5-mysql php5-curl \
  7. apache2 uwsgi uwsgi-plugin-psgi libplack-perl libdigest-hmac-perl libjson-xs-perl libfile-util-perl libapache2-mod-uwsgi libswitch-perl \
  8. git gnutls-bin runit wget curl net-tools vim build-essential
  9. # Zotero
  10. RUN mkdir -p /srv/zotero/log/upload && \
  11. mkdir -p /srv/zotero/log/download && \
  12. mkdir -p /srv/zotero/log/error && \
  13. mkdir -p /srv/zotero/log/api-errors && \
  14. mkdir -p /srv/zotero/log/sync-errors && \
  15. mkdir -p /srv/zotero/dataserver && \
  16. mkdir -p /srv/zotero/zss && \
  17. mkdir -p /var/log/httpd/sync-errors && \
  18. mkdir -p /var/log/httpd/api-errors && \
  19. chown www-data: /var/log/httpd/sync-errors && \
  20. chown www-data: /var/log/httpd/api-errors
  21. # Dataserver
  22. RUN git clone --depth=1 git://git.27o.de/dataserver /srv/zotero/dataserver && \
  23. chown www-data:www-data /srv/zotero/dataserver/tmp
  24. #RUN cd /srv/zotero/dataserver/include && rm -r Zend && ln -s /usr/share/php/libzend-framework-php/Zend
  25. RUN cd /srv/zotero/dataserver/include && rm -r Zend && ln -s /usr/share/php/Zend
  26. #Apache2
  27. #certtool -p --sec-param high --outfile /etc/apache2/zotero.key
  28. #certtool -s --load-privkey /etc/apache2/zotero.key --outfile /etc/apache2/zotero.cert
  29. ADD apache/zotero.key /etc/apache2/
  30. ADD apache/zotero.cert /etc/apache2/
  31. ADD apache/sites-zotero.conf /etc/apache2/sites-available/zotero
  32. ADD apache/dot.htaccess /srv/zotero/dataserver/htdocs/\.htaccess
  33. RUN a2enmod ssl && \
  34. a2enmod rewrite && \
  35. a2ensite zotero
  36. #Mysql
  37. ADD mysql/zotero.cnf /etc/mysql/conf.d/zotero.cnf
  38. ADD mysql/setup_db /srv/zotero/dataserver/misc/setup_db
  39. RUN /etc/init.d/mysql start && \
  40. mysqladmin -u root password password && \
  41. cd /srv/zotero/dataserver/misc/ && \
  42. ./setup_db
  43. # Zotero Configuration
  44. ADD dataserver/dbconnect.inc.php dataserver/config.inc.php /srv/zotero/dataserver/include/config/
  45. ADD dataserver/sv/zotero-download /etc/sv/zotero-download
  46. ADD dataserver/sv/zotero-upload /etc/sv/zotero-upload
  47. ADD dataserver/sv/zotero-error /etc/sv/zotero-error
  48. RUN cd /etc/service && \
  49. ln -s ../sv/zotero-download /etc/service/ && \
  50. ln -s ../sv/zotero-upload /etc/service/ && \
  51. ln -s ../sv/zotero-error /etc/service/
  52. # ZSS
  53. RUN git clone --depth=1 git://git.27o.de/zss /srv/zotero/zss && \
  54. mkdir /srv/zotero/storage && \
  55. chown www-data:www-data /srv/zotero/storage
  56. ADD zss/zss.yaml /etc/uwsgi/apps-available/
  57. ADD zss/ZSS.pm /srv/zotero/zss/
  58. ADD zss/zss.psgi /srv/zotero/zss/
  59. RUN ln -s /etc/uwsgi/apps-available/zss.yaml /etc/uwsgi/apps-enabled
  60. # fix uwsgi init scipt (always fails)
  61. ADD patches/uwsgi /etc/init.d/uwsgi
  62. ## failed attempt to install Zotero Web-Library locally
  63. ## not working
  64. #RUN cd /srv/ && \
  65. # git clone --depth=1 --recursive https://github.com/zotero/web-library.git && \
  66. # curl -sL https://deb.nodesource.com/setup_4.x | bash - && apt-get install -y nodejs && \
  67. # cd /srv/web-library && \
  68. # npm install && \
  69. # npm install prompt
  70. # replace custom /srv/zotero/dataserver/admin/add_user that allows to write the password
  71. ADD patches/add_user /srv/zotero/dataserver/admin/add_user
  72. # TEST ADD USER: test PASSWORD: test
  73. RUN service mysql start && service memcached start && \
  74. cd /srv/zotero/dataserver/admin && \
  75. ./add_user 101 test test && \
  76. ./add_user 102 test2 test2 && \
  77. ./add_group -o test -f members -r members -e members testgroup && \
  78. ./add_groupuser testgroup test2 member
  79. # docker server startup
  80. EXPOSE 80 443
  81. CMD service mysql start && \
  82. service uwsgi start && \
  83. service apache2 start && \
  84. service memcached start && \
  85. bash -c "/usr/sbin/runsvdir-start&" && \
  86. /bin/bash