From ddf3a3376b5bf27efc8ed1c0c324df0800e1573e Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Thu, 3 Aug 2017 19:01:46 +0200 Subject: [PATCH] Optimize owncloud build --- owncloud/Dockerfile | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/owncloud/Dockerfile b/owncloud/Dockerfile index a6407f5..3839344 100644 --- a/owncloud/Dockerfile +++ b/owncloud/Dockerfile @@ -13,43 +13,43 @@ RUN mkdir -p /run/mysqld \ /run/php # Setup php -RUN sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini -RUN sed -i "s/;env\[HOSTNAME\] = $HOSTNAME/env\[HOSTNAME\] = $HOSTNAME/g" /etc/php/7.0/fpm/pool.d/www.conf -RUN sed -i "s/;env\[PATH\] = \/usr\/local\/bin:\/usr\/bin:\/bin/env\[PATH\] = \/usr\/local\/bin:\/usr\/bin:\/bin/g" /etc/php/7.0/fpm/pool.d/www.conf -RUN sed -i "s/;env\[TMP\] = \/tmp/env\[TMP\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf -RUN sed -i "s/;env\[TMPDIR\] = \/tmp/env\[TMPDIR\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf -RUN sed -i "s/;env\[TEMP\] = \/tmp/env\[TEMP\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf +RUN sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g" /etc/php/7.0/fpm/php.ini && + sed -i "s/;env\[HOSTNAME\] = $HOSTNAME/env\[HOSTNAME\] = $HOSTNAME/g" /etc/php/7.0/fpm/pool.d/www.conf && + sed -i "s/;env\[PATH\] = \/usr\/local\/bin:\/usr\/bin:\/bin/env\[PATH\] = \/usr\/local\/bin:\/usr\/bin:\/bin/g" /etc/php/7.0/fpm/pool.d/www.conf && + sed -i "s/;env\[TMP\] = \/tmp/env\[TMP\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf && + sed -i "s/;env\[TMPDIR\] = \/tmp/env\[TMPDIR\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf && + sed -i "s/;env\[TEMP\] = \/tmp/env\[TEMP\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf # Setup nginx -RUN rm -rf /etc/nginx/sites-enabled/default ADD owncloud /etc/nginx/sites-available/owncloud -RUN ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/owncloud -RUN sed -i "s/\/var\/log\/nginx/\/data\/nginx-log/g" /etc/nginx/nginx.conf +RUN rm -rf /etc/nginx/sites-enabled/default && + ln -s /etc/nginx/sites-available/owncloud /etc/nginx/sites-enabled/owncloud && + sed -i "s/\/var\/log\/nginx/\/data\/nginx-log/g" /etc/nginx/nginx.conf # Setup MySQL -RUN sed -i "s/\/var\/lib\/mysql/\/data\/mysql/g" /etc/mysql/mysql.conf.d/mysqld.cnf -RUN chown mysql:mysql /var/run/mysqld +RUN sed -i "s/\/var\/lib\/mysql/\/data\/mysql/g" /etc/mysql/mysql.conf.d/mysqld.cnf && + chown mysql:mysql /var/run/mysqld # Setup owncloud RUN rm -rf /var/www/* ADD https://download.owncloud.org/community/owncloud-${OWNCLOUD_VER}.tar.bz2 /var/www -RUN tar xf /var/www/owncloud-${OWNCLOUD_VER}.tar.bz2 -C /var/www -RUN mv /var/www/owncloud/* /var/www -RUN rm /var/www/owncloud-${OWNCLOUD_VER}.tar.bz2 \ +RUN tar xf /var/www/owncloud-${OWNCLOUD_VER}.tar.bz2 -C /var/www && + mv /var/www/owncloud/* /var/www + rm /var/www/owncloud-${OWNCLOUD_VER}.tar.bz2 \ /var/www/owncloud/.htaccess \ - /var/www/owncloud/.user.ini -RUN rmdir /var/www/owncloud -RUN echo "*/15 * * * * www-data php -f /var/www/cron.php" >> /etc/crontab + /var/www/owncloud/.user.ini && + rmdir /var/www/owncloud && + echo "*/15 * * * * www-data php -f /var/www/cron.php" >> /etc/crontab # Provision data -RUN mkdir -p /provision/owncloud -RUN cp -r /var/www/apps /provision/owncloud -RUN cp -r /var/www/config /provision/owncloud -RUN rm -rf /var/www/apps \ - /var/www/config -RUN ln -s /data/owncloud/config /var/www -RUN ln -s /data/owncloud/apps /var/www -RUN ln -s /data/owncloud/data /var/www +RUN mkdir -p /provision/owncloud && + cp -r /var/www/apps /provision/owncloud && + cp -r /var/www/config /provision/owncloud && + rm -rf /var/www/apps \ + /var/www/config && + ln -s /data/owncloud/config /var/www && + ln -s /data/owncloud/apps /var/www && + ln -s /data/owncloud/data /var/www EXPOSE 80 VOLUME ["/data"]