pixelfed/contrib/docker/Dockerfile.apache

101 lines
2.7 KiB
Text
Raw Normal View History

FROM php:8.0-apache
ENV COMPOSER_MEMORY_LIMIT=-1
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /var/www/
2018-06-09 11:52:13 +00:00
# Get Composer binary
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install package dependencies
RUN apt-get update \
2020-04-21 21:18:08 +00:00
&& 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/
# Use the default production configuration
COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
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
RUN php artisan horizon:publish
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"]