pixelfed/Containerfile

72 lines
3.1 KiB
Text
Raw Normal View History

2023-06-05 22:16:19 +00:00
FROM docker.io/php:8.1-apache-bullseye as builder
2020-05-28 16:18:10 +00:00
2023-10-07 12:55:37 +00:00
ARG VERSION=dev
2020-08-14 06:39:01 +00:00
ARG DATE
2020-05-28 16:18:10 +00:00
RUN set -xe;\
2023-06-05 22:16:19 +00:00
apt-get update &&\
apt-get install --no-install-recommends -y git locales libcurl4-openssl-dev libzip-dev libicu-dev libxml2-dev libjpeg62-turbo-dev libpng-dev libmagickwand-dev libpq-dev libxpm-dev libwebp-dev &&\
apt-get clean all &&\
rm -rf /var/lib/apt/lists/*
RUN set -xe;\
docker-php-ext-configure mbstring --disable-mbregex &&\
docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp --with-xpm &&\
2023-06-20 18:43:34 +00:00
docker-php-ext-install -j$(nproc) curl zip bcmath intl mbstring xml pcntl gd mysqli pdo_mysql pdo_pgsql opcache &&\
2023-06-05 22:16:19 +00:00
pecl install imagick &&\
pecl install redis &&\
docker-php-ext-enable imagick redis
2023-04-20 11:58:57 +00:00
RUN set -xe;\
curl https://raw.githubusercontent.com/composer/getcomposer.org/0a51b6fe383f7f61cf1d250c742ec655aa044c94/web/installer | php -- --quiet --2.2 &&\
mv composer.phar /usr/local/bin/composer
2023-06-05 22:16:19 +00:00
2023-10-08 13:00:18 +00:00
COPY patches/ /patches/
2022-11-14 11:13:04 +00:00
RUN set -xe;\
2020-05-28 16:18:10 +00:00
cd /var && rm -rf www &&\
git clone https://github.com/pixelfed/pixelfed.git www &&\
cd www &&\
2023-10-07 12:55:37 +00:00
git checkout $VERSION &&\
2023-10-08 13:00:18 +00:00
git apply /patches/0001-remove-IP-logging.patch &&\
git apply /patches/0002-hardcode-discovery-settings.patch &&\
git apply /patches/0003-point-to-modified-sourcecode.patch &&\
git apply /patches/0004-disable-beagle-service.patch &&\
git apply /patches/0005-allow-30-char-usernames.patch &&\
2020-06-18 13:41:38 +00:00
composer install --prefer-dist --no-interaction --no-ansi --no-dev --optimize-autoloader &&\
2020-05-28 16:18:10 +00:00
ln -s public html &&\
chown -R www-data:www-data /var/www &&\
cp -r storage storage.skel &&\
2023-10-08 13:00:18 +00:00
rm -rf .git tests contrib CHANGELOG.md LICENSE .circleci .dependabot .github CODE_OF_CONDUCT.md .env.docker CONTRIBUTING.md README.md docker-compose.yml .env.testing phpunit.xml .env.example .gitignore .editorconfig .gitattributes .dockerignore /patches
2020-05-28 16:18:10 +00:00
2023-06-05 22:16:19 +00:00
FROM docker.io/php:8.1-apache-bullseye
ARG DATE
2023-10-07 12:55:37 +00:00
ARG VERSION=dev
2023-06-05 22:16:19 +00:00
2020-05-28 16:18:10 +00:00
COPY --from=builder /var/www /var/www
COPY entrypoint.sh /entrypoint.sh
2020-05-30 10:52:02 +00:00
COPY worker-entrypoint.sh /worker-entrypoint.sh
2022-07-08 12:10:30 +00:00
COPY websockets-entrypoint.sh /websockets-entrypoint.sh
2020-05-30 10:46:57 +00:00
COPY wait-for-db.php /wait-for-db.php
2023-06-05 22:16:19 +00:00
COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20210902 /usr/local/lib/php/extensions/no-debug-non-zts-20210902
COPY --from=builder /usr/local/etc/php/conf.d /usr/local/etc/php/conf.d
RUN set -xe;\
apt-get update &&\
apt-get install --no-install-recommends -y libzip4 libpq5 libmagickwand-6.q16-6 libxpm4 libwebp6 &&\
apt-get install --no-install-recommends -y optipng pngquant jpegoptim gifsicle ffmpeg locales gosu dumb-init &&\
apt-get clean all &&\
rm -rf /var/lib/apt/lists/*
RUN set -xe;\
2020-05-29 11:12:26 +00:00
a2enmod rewrite &&\
2020-06-27 01:01:49 +00:00
sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf &&\
2023-06-20 18:43:47 +00:00
sed -i 's/^post_max_size.*/post_max_size = 100M/g' "$PHP_INI_DIR"/php.ini* &&\
sed -i 's/^upload_max_filesize.*/upload_max_filesize = 100M/g' "$PHP_INI_DIR"/php.ini* &&\
mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
2020-05-29 11:12:26 +00:00
WORKDIR /var/www
2020-05-28 16:18:10 +00:00
VOLUME /var/www/storage /var/www/bootstrap
ENTRYPOINT /entrypoint.sh
2020-08-14 06:39:01 +00:00
2023-10-07 12:55:37 +00:00
LABEL build.date=$DATE version.pixelfed=$VERSION