diff --git a/Dockerfiles/h5ai/Dockerfile b/Dockerfiles/h5ai/Dockerfile index b0a7488..34b130c 100644 --- a/Dockerfiles/h5ai/Dockerfile +++ b/Dockerfiles/h5ai/Dockerfile @@ -1,33 +1,20 @@ -FROM ubuntu:14.04 +FROM ubuntu:trusty MAINTAINER Jean Froment -ENV DEBIAN_FRONTEND noninteractive -ENV H5AI_VERSION 0.29.0 -ENV HTTPD_USER www-data +RUN apt-get update && apt-get install -y nginx php5-fpm supervisor wget unzip patch -RUN apt-get update && apt-get install -y \ - nginx php5-fpm supervisor \ - wget unzip patch acl \ - libav-tools imagemagick \ - graphicsmagick zip unzip php5-gd +# download latest release +RUN wget http:`(wget https://larsjung.de/h5ai/ -q -O -) | sed 's/.*href="\(.*\.zip\)".*/\1/p' | head -n1` +RUN unzip h5ai-*.zip -d /usr/share/h5ai -# install h5ai and patch configuration -RUN wget http://release.larsjung.de/h5ai/h5ai-$H5AI_VERSION.zip -RUN unzip h5ai-$H5AI_VERSION.zip -d /usr/share/h5ai +ADD h5ai.nginx.conf /etc/nginx/sites-available/default -# patch h5ai because we want to deploy it ouside of the document root and use /var/www as root for browsing -COPY class-setup.php.patch class-setup.php.patch -RUN patch -p1 -u -d /usr/share/h5ai/_h5ai/private/php/core/ -i /class-setup.php.patch && rm class-setup.php.patch +VOLUME /torrents -RUN rm /etc/nginx/sites-enabled/default +ADD h5ai-path.patch patch +RUN patch -p1 -u -d /usr/share/h5ai/_h5ai/private/php/core/ -i /patch && rm patch -#make the cache writable -RUN chown ${HTTPD_USER} /usr/share/h5ai/_h5ai/public/cache/ -RUN chown ${HTTPD_USER} /usr/share/h5ai/_h5ai/private/cache/ - -# use supervisor to monitor all services -COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf +ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf CMD supervisord -c /etc/supervisor/conf.d/supervisord.conf -# expose only nginx HTTP port EXPOSE 80 \ No newline at end of file diff --git a/Dockerfiles/h5ai/class-setup.php.patch b/Dockerfiles/h5ai/h5ai-patch.patch similarity index 71% rename from Dockerfiles/h5ai/class-setup.php.patch rename to Dockerfiles/h5ai/h5ai-patch.patch index fc91f31..37f4376 100644 --- a/Dockerfiles/h5ai/class-setup.php.patch +++ b/Dockerfiles/h5ai/h5ai-patch.patch @@ -1,11 +1,13 @@ +diff --git a/class-setup.php b/class-setup.php +index 8743dee..663c069 100644 --- a/class-setup.php +++ b/class-setup.php -@@ -97,7 +97,7 @@ class Setup { +@@ -106,7 +106,7 @@ class Setup { $this->set('H5AI_PATH', Util::normalize_path(dirname(dirname(dirname(dirname(__FILE__)))), false)); - + $this->set('ROOT_HREF', Util::normalize_path(dirname($this->get('H5AI_HREF')), true)); - $this->set('ROOT_PATH', Util::normalize_path(dirname($this->get('H5AI_PATH')), false)); -+ $this->set('ROOT_PATH', "/var/www"); - ++ $this->set('ROOT_PATH', '/torrents'); + $this->set('PUBLIC_HREF', Util::normalize_path($this->get('H5AI_HREF') . '/public/', true)); $this->set('PUBLIC_PATH', Util::normalize_path($this->get('H5AI_PATH') . '/public/', false)); \ No newline at end of file diff --git a/Dockerfiles/h5ai/h5ai.nginx.conf b/Dockerfiles/h5ai/h5ai.nginx.conf new file mode 100644 index 0000000..91c43bd --- /dev/null +++ b/Dockerfiles/h5ai/h5ai.nginx.conf @@ -0,0 +1,13 @@ +server { + listen 80; + root /var/www; + index /_h5ai/public/index.php; + try_files $uri $uri/ =404; + location /_h5ai/ { + root /usr/share/h5ai/; + location /_h5ai/public/index.php { + fastcgi_pass unix:/var/run/php5-fpm.sock; + include fastcgi_params; + } + } +} \ No newline at end of file diff --git a/Dockerfiles/h5ai/supervisord.conf b/Dockerfiles/h5ai/supervisord.conf index 0fc07a4..92648c8 100644 --- a/Dockerfiles/h5ai/supervisord.conf +++ b/Dockerfiles/h5ai/supervisord.conf @@ -1,6 +1,5 @@ [supervisord] nodaemon=true -logfile=/var/log/supervisor/supervisord.log [program:php5-fpm] command=/usr/sbin/php5-fpm --nodaemonize diff --git a/docker-compose.yml b/docker-compose.yml index e838715..d5d1621 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -64,7 +64,7 @@ services: ports: - "12333:80" volumes: - - torrents:/var/www + - torrents:/torrents - config:/config env_file: - config