132 lines
3.8 KiB
Docker
132 lines
3.8 KiB
Docker
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=dev
|
|
|
|
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"]
|