From 496a183ffaf931f96104ff5c89acaeb16c6f91f6 Mon Sep 17 00:00:00 2001 From: asonix Date: Wed, 15 Jan 2020 09:17:47 -0600 Subject: [PATCH] Don't include unneeded tools --- pixelfed/Dockerfile | 63 +++++++++++++++++++++++---------------- pixelfed/pixelfed | 3 +- pixelfed/pixelfed-cache | 9 ------ pixelfed/pixelfed-clean | 11 ------- pixelfed/pixelfed-garbage | 6 +--- pixelfed/pixelfed-startup | 4 ++- pixelfed/pixelfed-update | 18 ----------- 7 files changed, 44 insertions(+), 70 deletions(-) delete mode 100755 pixelfed/pixelfed-cache delete mode 100755 pixelfed/pixelfed-clean delete mode 100755 pixelfed/pixelfed-update diff --git a/pixelfed/Dockerfile b/pixelfed/Dockerfile index 0379aac..dca0393 100644 --- a/pixelfed/Dockerfile +++ b/pixelfed/Dockerfile @@ -65,18 +65,6 @@ RUN a2enmod rewrite remoteip ;\ } > /etc/apache2/conf-available/remoteip.conf;\ a2enconf remoteip -ENV TAG=v0.10.7 - -RUN set -ex; \ - fetchDeps=git; \ - apt-get update; \ - apt-get install -y --no-install-recommends $fetchDeps; \ - \ - git clone -b $TAG https://github.com/pixelfed/pixelfed /var/www/pixelfed; \ - \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \ - rm -rf /var/lib/apt/lists/* - RUN mkdir /scratch WORKDIR /scratch @@ -88,25 +76,50 @@ RUN set -ex; \ test "$SIGNATURE" = "$SIG"; \ php composer-setup.php --install-dir /usr/local/bin --filename=composer -RUN apt-get update; \ - apt-get install -y pngquant jpegoptim optipng tini; \ +RUN rm -r /scratch + +ENV TAG=v0.10.7 + +RUN set -ex; \ + fetchDeps=git; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps + +RUN chown -R www-data:root /var/www; \ + find /var/www -type d -exec chmod 755 {} \;; \ + find /var/www -type f -exec chmod 644 {} \; + +USER www-data +RUN git clone -b $TAG https://github.com/pixelfed/pixelfed /var/www/pixelfed +USER root + +RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \ rm -rf /var/lib/apt/lists/* +RUN apt-get update; \ + apt-get install -y pngquant jpegoptim optipng tini unzip; \ + rm -rf /var/lib/apt/lists/* + +COPY pixelfed /usr/local/bin/pf +COPY pixelfed-garbage /usr/local/bin/pixelfed-garbage +COPY pixelfed-startup /usr/local/bin/pixelfed-startup +COPY pixelfed-run /usr/local/bin/pixelfed-run + +USER www-data + WORKDIR /var/www/pixelfed -RUN composer install --no-ansi --no-interaction --optimize-autoloader +RUN composer install \ + --no-ansi \ + --no-interaction \ + --optimize-autoloader \ + --no-scripts \ + --no-progress -RUN chown -R www-data:root /var/www/pixelfed; \ - find /var/www/pixelfed -type d -exec chmod 755 {} \;; \ - find /var/www/pixelfed -type f -exec chmod 644 {} \; +RUN php artisan view:cache \ + php artisan route:cache -COPY pixelfed /usr/local/bin/pixelfed -COPY pixelfed-cache /usr/local/bin/pixelfed-cache -COPY pixelfed-clean /usr/local/bin/pixelfed-clean -COPY pixelfed-run /usr/local/bin/pixelfed-run -COPY pixelfed-update /usr/local/bin/pixelfed-update -COPY pixelfed-garbage /usr/local/bin/pixelfed-garbage -COPY pixelfed-startup /usr/local/bin/pixelfed-startup +USER root ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["/usr/local/bin/pixelfed-startup", "/usr/local/bin/apache2-foreground"] diff --git a/pixelfed/pixelfed b/pixelfed/pixelfed index b20612b..beea500 100755 --- a/pixelfed/pixelfed +++ b/pixelfed/pixelfed @@ -5,5 +5,6 @@ COMMAND=pixelfed-$1 if which $COMMAND; then $COMMAND "${@:2}" else - pixelfed-run "${@:1}" + echo "Could not find command" + exit 1 fi diff --git a/pixelfed/pixelfed-cache b/pixelfed/pixelfed-cache deleted file mode 100755 index a2732e8..0000000 --- a/pixelfed/pixelfed-cache +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -pixelfed php artisan view:cache -pixelfed php artisan route:cache -pixelfed php artisan media:optimize -pixelfed php artisan config:cache -pixelfed php artisan optimize diff --git a/pixelfed/pixelfed-clean b/pixelfed/pixelfed-clean deleted file mode 100755 index 1f6d99e..0000000 --- a/pixelfed/pixelfed-clean +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -pixelfed php artisan view:clear -pixelfed php artisan route:clear -pixelfed php artisan optimize:clear -pixelfed php artisan media:gc -pixelfed php artisan config:clear -pixelfed php artisan cache:clear -pixelfed php artisan clear-compiled diff --git a/pixelfed/pixelfed-garbage b/pixelfed/pixelfed-garbage index 4aa4428..744a23a 100755 --- a/pixelfed/pixelfed-garbage +++ b/pixelfed/pixelfed-garbage @@ -2,8 +2,4 @@ set -xe -pushd /home/pixelfed/live - -pixelfed php artisan schedule:run - -popd +php artisan schedule:run diff --git a/pixelfed/pixelfed-startup b/pixelfed/pixelfed-startup index e3924b6..7e3e7a4 100755 --- a/pixelfed/pixelfed-startup +++ b/pixelfed/pixelfed-startup @@ -2,6 +2,8 @@ set -xe -pixelfed update +php artisan media:optimize +php artisan config:cache +php artisan optimize exec "$@" diff --git a/pixelfed/pixelfed-update b/pixelfed/pixelfed-update deleted file mode 100755 index 878f172..0000000 --- a/pixelfed/pixelfed-update +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -pixelfed clean - -pixelfed composer install \ - --no-ansi \ - --no-interaction \ - --no-progress \ - --no-scripts \ - --optimize-autoloader - -pixelfed composer dump-autoload -o -pixelfed php artisan migrate --force -pixelfed php artisan update - -pixelfed cache