Update synapse, start pixelfed

This commit is contained in:
asonix 2020-01-15 00:15:43 -06:00
parent 18cba26e4a
commit 76d9f8d95a
9 changed files with 198 additions and 2 deletions

112
pixelfed/Dockerfile Normal file
View file

@ -0,0 +1,112 @@
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 \
libmagickwand-dev \
libzip-dev \
libwebp-dev \
; \
\
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp; \
docker-php-ext-install -j "$(nproc)" \
bcmath \
intl \
gd \
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' > /usr/local/etc/php/conf.d/memory-limit.ini; \
sed -i'' 's/post_max_size.*/post_max_size = 42M/g' /usr/local/etc/php/php.ini-production; \
sed -i'' 's/file_uploads.*/file_uploads = On/g' /usr/local/etc/php/php.ini-production; \
sed -i'' 's/upload_max_filesize.*/upload_max_filesize = 40M/g' /usr/local/etc/php/php.ini-production; \
sed -i'' 's/max_file_uploads.*/max_file_uploads = 20/g' /usr/local/etc/php/php.ini-production; \
sed -i'' 's/max_execution_time.*/max_execution_time = 1200/g' /usr/local/etc/php/php.ini-production; \
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
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
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 apt-get update; \
apt-get install -y pngquant jpegoptim optipng tini; \
rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/pixelfed
RUN composer install --no-ansi --no-interaction --optimize-autoloader
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 {} \;
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
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/usr/local/bin/pixelfed-startup", "/usr/local/bin/apache2-foreground"]

9
pixelfed/pixelfed Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
COMMAND=pixelfed-$1
if which $COMMAND; then
$COMMAND "${@:2}"
else
pixelfed-run "${@:1}"
fi

9
pixelfed/pixelfed-cache Executable file
View file

@ -0,0 +1,9 @@
#!/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

11
pixelfed/pixelfed-clean Executable file
View file

@ -0,0 +1,11 @@
#!/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

9
pixelfed/pixelfed-garbage Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -xe
pushd /home/pixelfed/live
pixelfed php artisan schedule:run
popd

3
pixelfed/pixelfed-run Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
su www-data -s /bin/sh -c "$@"

7
pixelfed/pixelfed-startup Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -xe
pixelfed update
exec "$@"

18
pixelfed/pixelfed-update Executable file
View file

@ -0,0 +1,18 @@
#!/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

View file

@ -1,5 +1,21 @@
FROM arm64v8/alpine:3.11.2
ENV UID=991
ENV GID=991
RUN mkdir /opt/synapse
RUN addgroup --gid "$GID" synapse
RUN adduser \
--disabled-password \
--gecos "" \
--home /opt/synapse \
--ingroup synapse \
--no-create-home \
--uid "$UID" \
synapse
RUN chown -R synapse:synapse /opt/synapse
RUN apk add synapse
RUN apk add tini
@ -7,6 +23,8 @@ EXPOSE 8008/tcp
VOLUME /media_store
ENTRYPOINT /sbin/tini
USER synapse
WORKDIR /opt/synapse
CMD /usr/bin/python3 -m synapse.app.homeserver -c /etc/synapse/homeserver.yaml
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/bin/synctl", "--no-daemonize", "start", "/etc/synapse/homeserver.yaml"]