diff --git a/pixelfed/Dockerfile b/pixelfed/Dockerfile deleted file mode 100644 index 1ba470e..0000000 --- a/pixelfed/Dockerfile +++ /dev/null @@ -1,132 +0,0 @@ -FROM arm64v8/php:7.4.1-apache-buster - -RUN set -ex; \ - \ - savedAptMark="$(apt-mark showmanual)"; \ - \ - apt-get update; \ - apt-get install -y --no-install-recommends \ - libcurl4-openssl-dev \ - libevent-dev \ - libfreetype6-dev \ - libicu-dev \ - libjpeg-dev \ - libmcrypt-dev \ - libpng-dev \ - libpq-dev \ - libxml2-dev \ - libxpm-dev \ - libmagickwand-dev \ - libzip-dev \ - libwebp-dev \ - ; \ - \ - docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm; \ - docker-php-ext-install -j "$(nproc)" \ - bcmath \ - exif \ - gd \ - intl \ - pcntl \ - pdo_pgsql \ - pgsql \ - zip \ - ; \ - \ - pecl install imagick-3.4.4; \ - docker-php-ext-enable imagick; \ - \ - apt-mark auto '.*' > /dev/null; \ - apt-mark manual $savedAptMark; \ - ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \ - | awk '/=>/ { print $3 }' \ - | sort -u \ - | xargs -r dpkg-query -S \ - | cut -d: -f1 \ - | sort -u \ - | xargs -rt apt-mark manual; \ - \ - apt-get purge -y --autoremove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/* - -RUN {\ - echo memory_limit = 512M ;\ - echo post_max_size = 42M ;\ - echo file_uploads = On ;\ - echo max_file_uploads = 20 ;\ - echo max_execution_time = 1200 ;\ - echo upload_max_filesize = 40M ;\ - } > /usr/local/etc/php/conf.d/pixelfed.ini; \ - chown -R www-data:root /var/www; \ - chmod -R g=u /var/www - -RUN a2enmod rewrite remoteip ;\ - {\ - echo RemoteIPHeader X-Real-IP ;\ - echo RemoteIPTrustedProxy 10.0.0.0/8 ;\ - echo RemoteIPTrustedProxy 172.16.0.0/12 ;\ - echo RemoteIPTrustedProxy 192.168.0.0/16 ;\ - } > /etc/apache2/conf-available/remoteip.conf;\ - a2enconf remoteip - -RUN mkdir /scratch - -WORKDIR /scratch - -RUN set -ex; \ - SIGNATURE="$(curl https://composer.github.io/installer.sig)"; \ - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"; \ - SIG="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"; \ - test "$SIGNATURE" = "$SIG"; \ - php composer-setup.php --install-dir /usr/local/bin --filename=composer - -RUN rm -r /scratch - -ENV TAG=VERSION - -RUN set -ex; \ - fetchDeps=git; \ - apt-get update; \ - apt-get install -y --no-install-recommends $fetchDeps - -RUN rm -rf /var/www; \ - git clone -b $TAG https://github.com/pixelfed/pixelfed /var/www; \ - ln -s /var/www/public /var/www/html - -RUN chown -R www-data:root /var/www; \ - find /var/www -type d -exec chmod 755 {} \;; \ - find /var/www -type f -exec chmod 644 {} \; - -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 rsync; \ - rm -rf /var/lib/apt/lists/* - -USER www-data - -WORKDIR /var/www - -RUN composer install \ - --no-ansi \ - --no-interaction \ - --optimize-autoloader \ - --no-scripts \ - --no-progress - -RUN cp -r storage storage-default - -USER root - -COPY pixelfed /usr/local/bin/pixelfed -COPY pixelfed-run /usr/local/bin/pixelfed-run -COPY pixelfed-horizon /usr/local/bin/pixelfed-horizon -COPY pixelfed-startup /usr/local/bin/pixelfed-startup -COPY pixelfed-migrate /usr/local/bin/pixelfed-migrate -COPY pixelfed-garbage /usr/local/bin/pixelfed-garbage - -VOLUME /var/www/storage - -ENTRYPOINT ["/usr/bin/tini", "--"] -CMD ["/usr/local/bin/pixelfed-startup", "/usr/local/bin/apache2-foreground"] diff --git a/pixelfed/alpine/build.sh b/pixelfed/alpine/build.sh deleted file mode 100755 index 77c2f27..0000000 --- a/pixelfed/alpine/build.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -BUILD_DATE=$(date) -VERSION=$1 -PIXELFED_RELEASE=$2 - -function require() { - if [ "$1" = "" ]; then - echo "input '$2' required" - print_help - exit 1 - fi -} - -function print_help() { - echo "build.sh" - echo "" - echo "Usage:" - echo " build.sh [version] [pixelfed_release]" - echo "" - echo "Args:" - echo " version: The version of the current container" - echo " pixelfed_release: The release of pixelfed to include" -} - -function build_image() { - IMAGE=$1 - ARCH=$2 - - docker build \ - --pull \ - --no-cache \ - --build-arg BUILD_DATE="${BUILD_DATE}" \ - --build-arg PIXELFED_RELEASE="${PIXELFED_RELEASE}" \ - --build-arg VERSION="${VERSION}" \ - -f "Dockerfile.${ARCH}" \ - -t "${IMAGE}:${PIXELFED_RELEASE}-${VERSION}-${ARCH}" \ - -t "${IMAGE}:latest-${ARCH}" \ - -t "${IMAGE}:latest" \ - . - - docker push "${IMAGE}:${PIXELFED_RELEASE}-${VERSION}-${ARCH}" - docker push "${IMAGE}:latest-${ARCH}" - docker push "${IMAGE}:latest" -} - -require "$VERSION" "version" -require "$PIXELFED_RELEASE" "pixelfed release" - -set -xe - -pushd base -build_image asonix/pixelfed-base arm64v8 -popd - -pushd web -build_image asonix/pixelfed arm64v8 -popd diff --git a/pixelfed/alpine/base/Dockerfile.arm64v8 b/pixelfed/base/Dockerfile.arm64v8 similarity index 100% rename from pixelfed/alpine/base/Dockerfile.arm64v8 rename to pixelfed/base/Dockerfile.arm64v8 diff --git a/pixelfed/alpine/base/root/defaults/pixelfed-perms.sh b/pixelfed/base/root/defaults/pixelfed-perms.sh similarity index 100% rename from pixelfed/alpine/base/root/defaults/pixelfed-perms.sh rename to pixelfed/base/root/defaults/pixelfed-perms.sh diff --git a/pixelfed/alpine/base/root/etc/cont-init.d/50-install b/pixelfed/base/root/etc/cont-init.d/50-install similarity index 100% rename from pixelfed/alpine/base/root/etc/cont-init.d/50-install rename to pixelfed/base/root/etc/cont-init.d/50-install diff --git a/pixelfed/alpine/base/root/usr/bin/pixelfed b/pixelfed/base/root/usr/bin/pixelfed similarity index 100% rename from pixelfed/alpine/base/root/usr/bin/pixelfed rename to pixelfed/base/root/usr/bin/pixelfed diff --git a/pixelfed/alpine/base/root/usr/bin/pixelfed-garbage b/pixelfed/base/root/usr/bin/pixelfed-garbage similarity index 100% rename from pixelfed/alpine/base/root/usr/bin/pixelfed-garbage rename to pixelfed/base/root/usr/bin/pixelfed-garbage diff --git a/pixelfed/alpine/base/root/usr/bin/pixelfed-horizon b/pixelfed/base/root/usr/bin/pixelfed-horizon similarity index 100% rename from pixelfed/alpine/base/root/usr/bin/pixelfed-horizon rename to pixelfed/base/root/usr/bin/pixelfed-horizon diff --git a/pixelfed/base/root/usr/bin/pixelfed-migrate b/pixelfed/base/root/usr/bin/pixelfed-migrate new file mode 100755 index 0000000..f717b5a --- /dev/null +++ b/pixelfed/base/root/usr/bin/pixelfed-migrate @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -xe + +cd /srv/www/pixelfed + +pixelfed php artisan migrate --force +pixelfed php artisan update diff --git a/pixelfed/alpine/base/root/usr/bin/pixelfed-run b/pixelfed/base/root/usr/bin/pixelfed-run similarity index 100% rename from pixelfed/alpine/base/root/usr/bin/pixelfed-run rename to pixelfed/base/root/usr/bin/pixelfed-run diff --git a/pixelfed/build.sh b/pixelfed/build.sh index c7623dc..77c2f27 100755 --- a/pixelfed/build.sh +++ b/pixelfed/build.sh @@ -1,6 +1,8 @@ -#!/usr/bin//env bash +#!/usr/bin/env bash -TAG=$1 +BUILD_DATE=$(date) +VERSION=$1 +PIXELFED_RELEASE=$2 function require() { if [ "$1" = "" ]; then @@ -14,29 +16,43 @@ function print_help() { echo "build.sh" echo "" echo "Usage:" - echo " build.sh [tag]" + echo " build.sh [version] [pixelfed_release]" echo "" echo "Args:" - echo " tag: The tag of the pixelfed image the target image is based on" + echo " version: The version of the current container" + echo " pixelfed_release: The release of pixelfed to include" } -require "$TAG" tag +function build_image() { + IMAGE=$1 + ARCH=$2 + + docker build \ + --pull \ + --no-cache \ + --build-arg BUILD_DATE="${BUILD_DATE}" \ + --build-arg PIXELFED_RELEASE="${PIXELFED_RELEASE}" \ + --build-arg VERSION="${VERSION}" \ + -f "Dockerfile.${ARCH}" \ + -t "${IMAGE}:${PIXELFED_RELEASE}-${VERSION}-${ARCH}" \ + -t "${IMAGE}:latest-${ARCH}" \ + -t "${IMAGE}:latest" \ + . + + docker push "${IMAGE}:${PIXELFED_RELEASE}-${VERSION}-${ARCH}" + docker push "${IMAGE}:latest-${ARCH}" + docker push "${IMAGE}:latest" +} + +require "$VERSION" "version" +require "$PIXELFED_RELEASE" "pixelfed release" set -xe -sed "s/VERSION/$TAG/g" Dockerfile > "Dockerfile.$TAG" +pushd base +build_image asonix/pixelfed-base arm64v8 +popd -docker build \ - --pull \ - --no-cache \ - -f "Dockerfile.$TAG" \ - -t "asonix/pixelfed:$TAG-arm64v8" \ - -t asonix/pixelfed:latest-arm64v8 \ - -t asonix/pixelfed:latest \ - . - -docker push "asonix/pixelfed:$TAG-arm64v8" -docker push asonix/pixelfed:latest-arm64v8 -docker push asonix/pixelfed:latest - -rm "Dockerfile.$TAG" +pushd web +build_image asonix/pixelfed arm64v8 +popd diff --git a/pixelfed/pixelfed b/pixelfed/pixelfed deleted file mode 100755 index b20612b..0000000 --- a/pixelfed/pixelfed +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -COMMAND=pixelfed-$1 - -if which $COMMAND; then - $COMMAND "${@:2}" -else - pixelfed-run "${@:1}" -fi diff --git a/pixelfed/pixelfed-garbage b/pixelfed/pixelfed-garbage deleted file mode 100755 index 7950e00..0000000 --- a/pixelfed/pixelfed-garbage +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -pixelfed 'php artisan media:optimize' -pixelfed 'php artisan media:gc' -pixelfed 'php artisan horizon:snapshot' -pixelfed 'php artisan story:gc' diff --git a/pixelfed/pixelfed-horizon b/pixelfed/pixelfed-horizon deleted file mode 100755 index 941becf..0000000 --- a/pixelfed/pixelfed-horizon +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -pixelfed 'php artisan config:cache' -pixelfed 'php artisan storage:link' -pixelfed 'php artisan horizon' diff --git a/pixelfed/pixelfed-migrate b/pixelfed/pixelfed-migrate deleted file mode 100755 index f93c439..0000000 --- a/pixelfed/pixelfed-migrate +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -pixelfed 'php artisan migrate --force' -pixelfed 'php artisan update' diff --git a/pixelfed/pixelfed-run b/pixelfed/pixelfed-run deleted file mode 100755 index 98c1a14..0000000 --- a/pixelfed/pixelfed-run +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -su www-data -s /bin/sh -c "$@" diff --git a/pixelfed/pixelfed-startup b/pixelfed/pixelfed-startup deleted file mode 100755 index be5ad46..0000000 --- a/pixelfed/pixelfed-startup +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -xe - -echo "ServerName ${APP_DOMAIN}" > /etc/apache2/conf-available/servername.conf -a2enconf servername - -pixelfed 'rsync -rog storage-default/* storage/' -pixelfed 'php artisan config:cache' -pixelfed 'php artisan storage:link' -pixelfed 'php artisan horizon:install' -pixelfed 'php artisan horizon:assets' -pixelfed 'php artisan route:cache' -pixelfed 'php artisan view:cache' -pixelfed 'php artisan optimize' - -exec "$@" diff --git a/pixelfed/alpine/web/Dockerfile.arm64v8 b/pixelfed/web/Dockerfile.arm64v8 similarity index 100% rename from pixelfed/alpine/web/Dockerfile.arm64v8 rename to pixelfed/web/Dockerfile.arm64v8 diff --git a/pixelfed/alpine/web/root/defaults/default b/pixelfed/web/root/defaults/default similarity index 100% rename from pixelfed/alpine/web/root/defaults/default rename to pixelfed/web/root/defaults/default diff --git a/pixelfed/alpine/web/root/defaults/nginx.conf b/pixelfed/web/root/defaults/nginx.conf similarity index 100% rename from pixelfed/alpine/web/root/defaults/nginx.conf rename to pixelfed/web/root/defaults/nginx.conf diff --git a/pixelfed/alpine/web/root/defaults/pixelfed-perms.sh b/pixelfed/web/root/defaults/pixelfed-perms.sh similarity index 100% rename from pixelfed/alpine/web/root/defaults/pixelfed-perms.sh rename to pixelfed/web/root/defaults/pixelfed-perms.sh diff --git a/pixelfed/alpine/web/root/etc/cont-init.d/20-config b/pixelfed/web/root/etc/cont-init.d/20-config similarity index 100% rename from pixelfed/alpine/web/root/etc/cont-init.d/20-config rename to pixelfed/web/root/etc/cont-init.d/20-config diff --git a/pixelfed/alpine/web/root/etc/cont-init.d/40-config b/pixelfed/web/root/etc/cont-init.d/40-config similarity index 100% rename from pixelfed/alpine/web/root/etc/cont-init.d/40-config rename to pixelfed/web/root/etc/cont-init.d/40-config diff --git a/pixelfed/alpine/web/root/etc/cont-init.d/50-install b/pixelfed/web/root/etc/cont-init.d/50-install similarity index 100% rename from pixelfed/alpine/web/root/etc/cont-init.d/50-install rename to pixelfed/web/root/etc/cont-init.d/50-install diff --git a/pixelfed/alpine/web/root/etc/logrotate.d/nginx b/pixelfed/web/root/etc/logrotate.d/nginx similarity index 100% rename from pixelfed/alpine/web/root/etc/logrotate.d/nginx rename to pixelfed/web/root/etc/logrotate.d/nginx diff --git a/pixelfed/alpine/web/root/etc/logrotate.d/php-fpm7 b/pixelfed/web/root/etc/logrotate.d/php-fpm7 similarity index 100% rename from pixelfed/alpine/web/root/etc/logrotate.d/php-fpm7 rename to pixelfed/web/root/etc/logrotate.d/php-fpm7 diff --git a/pixelfed/alpine/web/root/etc/services.d/nginx/run b/pixelfed/web/root/etc/services.d/nginx/run similarity index 100% rename from pixelfed/alpine/web/root/etc/services.d/nginx/run rename to pixelfed/web/root/etc/services.d/nginx/run diff --git a/pixelfed/alpine/web/root/etc/services.d/php-fpm/run b/pixelfed/web/root/etc/services.d/php-fpm/run similarity index 100% rename from pixelfed/alpine/web/root/etc/services.d/php-fpm/run rename to pixelfed/web/root/etc/services.d/php-fpm/run