Dockerfile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. FROM phusion/baseimage:0.11
  2. MAINTAINER veizour
  3. # Set correct environment variables
  4. ENV DEBIAN_FRONTEND noninteractive
  5. ENV HOME /root
  6. ENV LC_ALL C.UTF-8
  7. ENV LANG en_US.UTF-8
  8. ENV LANGUAGE en_US.UTF-8
  9. ENV TERM xterm
  10. # Use baseimage-docker's init system
  11. CMD ["/sbin/my_init"]
  12. # Configure user nobody to match unRAID's settings
  13. RUN \
  14. usermod -u 99 nobody && \
  15. usermod -g 100 nobody && \
  16. usermod -d /home nobody && \
  17. chown -R nobody:users /home
  18. RUN add-apt-repository ppa:ondrej/php
  19. RUN apt-get update
  20. RUN apt-get upgrade -y
  21. RUN apt-get install -y mc
  22. RUN apt-get install -y tmux
  23. RUN apt-get install -y wget
  24. # Install proxy Dependencies
  25. RUN apt-get update -y
  26. RUN apt-get install -y apache2
  27. RUN apt-get install -y php7.1 php7.1-common libapache2-mod-php7.1 php7.1-mcrypt php7.1-cli php7.1-xml \
  28. php7.1-mysql php7.1-mysqlnd php7.1-gd php7.1-imagick php7.1-recode php7.1-tidy php7.1-xmlrpc \
  29. php-curl php7.1-mbstring php7.1-soap php7.1-intl php7.1-ldap php7.1-imap php-xml \
  30. php7.1-sqlite php7.1-mcrypt php7.1-zip inotify-tools
  31. RUN apt-get clean -y
  32. RUN rm -rf /var/lib/apt/lists/*
  33. RUN service apache2 restart
  34. RUN rm -R -f /var/www
  35. #RUN ln -s -v /web /var/www
  36. RUN mkdir -p /var/www/html/ossn/
  37. ADD https://www.opensource-socialnetwork.org/download_ossn/latest/build.zip /tmp/build.zip
  38. RUN unzip /tmp/build.zip -d /tmp
  39. RUN cp -R /tmp/ossn/. /var/www/html/ossn/.
  40. # Update apache configuration with this one
  41. RUN \
  42. mv /etc/apache2/sites-available/000-default.conf /etc/apache2/000-default.conf && \
  43. rm /etc/apache2/sites-available/* && \
  44. rm /etc/apache2/apache2.conf && \
  45. ln -s /config/proxy-config.conf /etc/apache2/sites-available/000-default.conf && \
  46. ln -s /var/log/apache2 /logs
  47. # Update ossn.config.db configs with variables
  48. RUN \
  49. set 's/<<host>>/${DBHost}/g' ossn.config.db && \
  50. set 's/<<port>>/${DBPort}/g' ossn.config.db && \
  51. set 's/<<password>>/${DBPassword}/g' ossn.config.db && \
  52. set 's/<<dbname>>/${DBUsername}/g' ossn.config.db
  53. # Update ossn.config.site configs with variables
  54. RUN \
  55. set 's/<<siteurl>>/${SiteURL}/g' ossn.config.site && \
  56. set 's/<<datadir>>/${DataDirectory}/g' ossn.config.site
  57. # Update ossn.conf configs with variables
  58. RUN \
  59. set 's/<<admin@server>>/${adminlogin}/g' ossn.conf && \
  60. set 's/<<servername>>/${servername}/g' ossn.conf
  61. ADD ossn.conf /etc/apache2/000-default.conf
  62. ADD apache2.conf /etc/apache2/apache2.conf
  63. ADD ports.conf /etc/apache2/ports.conf
  64. ADD ossn.config.db /var/www/html/ossn/configuration/ossn.config.db
  65. ADD ossn.config.site /var/www/html/ossn/configuration/ossn.config.site
  66. # Manually set the apache environment variables in order to get apache to work immediately.
  67. RUN \
  68. echo www-data > /etc/container_environment/APACHE_RUN_USER && \
  69. echo www-data > /etc/container_environment/APACHE_RUN_GROUP && \
  70. echo /var/log/apache2 > /etc/container_environment/APACHE_LOG_DIR && \
  71. echo /var/lock/apache2 > /etc/container_environment/APACHE_LOCK_DIR && \
  72. echo /var/run/apache2.pid > /etc/container_environment/APACHE_PID_FILE && \
  73. echo /var/run/apache2 > /etc/container_environment/APACHE_RUN_DIR
  74. # Expose Ports
  75. EXPOSE 80 443
  76. # The www directory and proxy config location
  77. #VOLUME ["/config", "/web", "/logs"]
  78. VOLUME ["/config", "/logs", "/data"]
  79. RUN chown -R www-data:www-data /var/www/html/ossn/
  80. RUN chmod -R 755 /var/www/html/ossn/
  81. RUN chown -R www-data:www-data /data
  82. # Add our crontab file
  83. ADD crons.conf /root/crons.conf
  84. # Add firstrun.sh to execute during container startup
  85. ADD firstrun.sh /etc/my_init.d/firstrun.sh
  86. RUN chmod +x /etc/my_init.d/firstrun.sh
  87. # Add inotify.sh to execute during container startup
  88. RUN mkdir /etc/service/inotify
  89. ADD inotify.sh /etc/service/inotify/run
  90. RUN chmod +x /etc/service/inotify/run
  91. # Add apache to runit
  92. RUN mkdir /etc/service/apache
  93. ADD apache-run.sh /etc/service/apache/run
  94. RUN chmod +x /etc/service/apache/run
  95. ADD apache-finish.sh /etc/service/apache/finish
  96. RUN chmod +x /etc/service/apache/finish
  97. RUN a2enmod rewrite