1
0
Fork 0
forked from mirror/pixelfed
pixelfed/contrib/docker/Dockerfile.apache

101 lines
3.2 KiB
Text
Raw Normal View History

FROM php:7.4-apache-buster
2018-06-09 11:52:13 +00:00
2020-04-11 15:48:02 +00:00
# Use the default production configuration
COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
# Install Composer
2020-11-01 20:05:39 +00:00
ENV COMPOSER_VERSION=1.10.11 \
2020-04-21 21:18:08 +00:00
COMPOSER_HOME=/var/www/.composer \
COMPOSER_MEMORY_LIMIT=-1 \
PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /var/www/
2020-04-11 15:48:02 +00:00
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
2020-04-21 21:18:08 +00:00
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php \
&& apt-get update \
&& apt-get upgrade -y \
# && apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y --no-install-recommends \
2020-04-11 15:48:02 +00:00
## Standard
2020-04-21 21:18:08 +00:00
locales \
locales-all \
2020-04-11 15:48:02 +00:00
git \
gosu \
zip \
unzip \
libzip-dev \
libcurl4-openssl-dev \
## Image Optimization
optipng \
pngquant \
jpegoptim \
gifsicle \
## Image Processing
libjpeg62-turbo-dev \
libpng-dev \
2020-04-21 21:18:08 +00:00
libmagickwand-dev \
2020-04-11 15:48:02 +00:00
# Required for GD
libxpm4 \
libxpm-dev \
libwebp6 \
libwebp-dev \
## Video Processing
2020-04-21 21:18:08 +00:00
ffmpeg \
## Database
# libpq-dev \
# libsqlite3-dev \
mariadb-client \
# Locales Update
&& sed -i '/en_US/s/^#//g' /etc/locale.gen \
&& locale-gen \
&& update-locale \
2020-04-11 15:48:02 +00:00
# Install PHP extensions
2020-04-21 21:18:08 +00:00
&& docker-php-source extract \
2020-04-11 15:48:02 +00:00
#PHP Imagemagick extensions
2020-04-21 21:18:08 +00:00
&& pecl install imagick \
&& docker-php-ext-enable imagick \
2020-04-11 15:48:02 +00:00
# PHP GD extensions
2020-04-21 21:18:08 +00:00
&& docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp \
2020-04-21 21:18:08 +00:00
--with-xpm \
&& docker-php-ext-install -j$(nproc) gd \
2020-04-11 15:48:02 +00:00
#PHP Redis extensions
2020-04-21 21:18:08 +00:00
&& pecl install redis \
&& docker-php-ext-enable redis \
2020-04-11 15:48:02 +00:00
#PHP Database extensions
2020-04-21 21:18:08 +00:00
&& docker-php-ext-install pdo_mysql \
#pdo_pgsql pdo_sqlite \
2020-04-11 15:48:02 +00:00
#PHP extensions (dependencies)
2020-04-21 21:18:08 +00:00
&& docker-php-ext-configure intl \
&& docker-php-ext-install -j$(nproc) intl bcmath zip pcntl exif curl \
2020-04-11 15:48:02 +00:00
#APACHE Bootstrap
2020-04-21 21:18:08 +00:00
&& 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 ;\
echo SetEnvIf X-Forwarded-Proto "https" HTTPS=on ;\
} > /etc/apache2/conf-available/remoteip.conf \
2020-04-21 21:18:08 +00:00
&& a2enconf remoteip \
2020-04-11 15:48:02 +00:00
#Cleanup
2020-04-21 21:18:08 +00:00
&& docker-php-source delete \
&& apt-get autoremove --purge -y \
&& apt-get clean \
&& rm -rf /var/cache/apt \
&& rm -rf /var/lib/apt/lists/
2018-06-09 13:18:44 +00:00
COPY . /var/www/
2020-04-21 21:18:08 +00:00
# for detail why storage is copied this way, pls refer to https://github.com/pixelfed/pixelfed/pull/2137#discussion_r434468862
RUN cp -r storage storage.skel \
&& composer install --prefer-dist --no-interaction --no-ansi --optimize-autoloader \
&& rm -rf html && ln -s public html \
&& chown -R www-data:www-data /var/www
2019-04-16 06:18:53 +00:00
VOLUME /var/www/storage /var/www/bootstrap
2018-06-09 11:52:13 +00:00
2020-04-11 15:48:02 +00:00
CMD ["/var/www/contrib/docker/start.apache.sh"]