Optimize nextcloud build

This commit is contained in:
Przemek Grondek 2017-08-03 19:03:42 +02:00
parent ddf3a3376b
commit d706a0fb08

View File

@ -13,43 +13,43 @@ RUN mkdir -p /run/mysqld \
/run/php /run/php
# Setup 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/;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 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 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 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 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 sed -i "s/;env\[TEMP\] = \/tmp/env\[TEMP\] = \/tmp/g" /etc/php/7.0/fpm/pool.d/www.conf
# Setup nginx # Setup nginx
RUN rm -rf /etc/nginx/sites-enabled/default
ADD nextcloud /etc/nginx/sites-available/nextcloud ADD nextcloud /etc/nginx/sites-available/nextcloud
RUN ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/nextcloud RUN rm -rf /etc/nginx/sites-enabled/default &&
RUN sed -i "s/\/var\/log\/nginx/\/data\/nginx-log/g" /etc/nginx/nginx.conf ln -s /etc/nginx/sites-available/nextcloud /etc/nginx/sites-enabled/nextcloud &&
sed -i "s/\/var\/log\/nginx/\/data\/nginx-log/g" /etc/nginx/nginx.conf
# Setup MySQL # Setup MySQL
RUN sed -i "s/\/var\/lib\/mysql/\/data\/mysql/g" /etc/mysql/mysql.conf.d/mysqld.cnf RUN sed -i "s/\/var\/lib\/mysql/\/data\/mysql/g" /etc/mysql/mysql.conf.d/mysqld.cnf &&
RUN chown mysql:mysql /var/run/mysqld chown mysql:mysql /var/run/mysqld
# Setup nextcloud # Setup nextcloud
RUN rm -rf /var/www/* RUN rm -rf /var/www/*
ADD https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VER}.tar.bz2 /var/www ADD https://download.nextcloud.com/server/releases/nextcloud-${NEXTCLOUD_VER}.tar.bz2 /var/www
RUN tar xf /var/www/nextcloud-${NEXTCLOUD_VER}.tar.bz2 -C /var/www RUN tar xf /var/www/nextcloud-${NEXTCLOUD_VER}.tar.bz2 -C /var/www &&
RUN mv /var/www/nextcloud/* /var/www mv /var/www/nextcloud/* /var/www &&
RUN rm /var/www/nextcloud-${NEXTCLOUD_VER}.tar.bz2 \ rm /var/www/nextcloud-${NEXTCLOUD_VER}.tar.bz2 \
/var/www/nextcloud/.htaccess \ /var/www/nextcloud/.htaccess \
/var/www/nextcloud/.user.ini /var/www/nextcloud/.user.ini &&
RUN rmdir /var/www/nextcloud rmdir /var/www/nextcloud &&
RUN echo "*/15 * * * * www-data php -f /var/www/cron.php" >> /etc/crontab echo "*/15 * * * * www-data php -f /var/www/cron.php" >> /etc/crontab
# Provision data # Provision data
RUN mkdir -p /provision/nextcloud RUN mkdir -p /provision/nextcloud &&
RUN cp -r /var/www/apps /provision/nextcloud cp -r /var/www/apps /provision/nextcloud &&
RUN cp -r /var/www/config /provision/nextcloud cp -r /var/www/config /provision/nextcloud &&
RUN rm -rf /var/www/apps \ rm -rf /var/www/apps \
/var/www/config /var/www/config &&
RUN ln -s /data/nextcloud/config /var/www ln -s /data/nextcloud/config /var/www &&
RUN ln -s /data/nextcloud/apps /var/www ln -s /data/nextcloud/apps /var/www &&
RUN ln -s /data/nextcloud/data /var/www ln -s /data/nextcloud/data /var/www
EXPOSE 80 EXPOSE 80
VOLUME ["/data"] VOLUME ["/data"]