php/Dockerfile
2021-07-06 15:44:33 +10:00

67 lines
2.7 KiB
Docker

# NAME leenooks/php
# VERSION 8.0-fpm-latest
FROM php:8.0-fpm
RUN apt-get update && apt-get install -y openssh-server unzip git msmtp nginx wait-for-it \
&& rm /etc/nginx/sites-enabled/default \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN useradd -c "Hosting Admin User" -u 1000 -g users -G www-data -d /var/www/html -M lamp
RUN sed -e 's/^expose_php = On/expose_php = Off/' /usr/local/etc/php/php.ini-production > /usr/local/etc/php/php.ini
COPY www.conf /usr/local/etc/php-fpm.d/
COPY nginx-app.conf /etc/nginx/conf.d/
COPY sshd_config.patch /tmp/
RUN (cd / && patch -p0 ) < /tmp/sshd_config.patch && rm /tmp/sshd_config.patch
COPY msmtprc /etc/
RUN sed -i -e 's#^;sendmail_path =#sendmail_path = "/usr/bin/msmtp -t"#' /usr/local/etc/php/php.ini && sed -i -e 's#^memory_limit = 128M#memory_limit = 256M#' /usr/local/etc/php/php.ini
EXPOSE 22/tcp
# Add composer
RUN curl https://getcomposer.org/installer|php -- --install-dir=/usr/local/bin --filename=composer
# Add Mongo DB
RUN pecl install mongodb && docker-php-ext-enable mongodb \
&& rm -rf /tmp/*
# Mysql/Postgress/LDAP
RUN apt-get update && apt-get install -y openssh-server libpq5 libpq-dev unzip git libldap2-dev \
&& docker-php-ext-install -j$(nproc) pdo_mysql pdo_pgsql ldap gettext \
&& apt-get -y purge libpq-dev libldap2-dev libx11-6 dbus ncurses-term systemd \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Enable phpredis
RUN apt-get update && apt-get install -y redis \
&& pecl install -o -f igbinary && pecl install -o -f redis && docker-php-ext-enable redis igbinary \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Enable phpmemcache
RUN apt-get update && apt-get install -y memcached libmemcachedutil2 zlib1g-dev libmemcached-dev \
&& pecl install -o -f memcached && docker-php-ext-enable memcached \
&& apt-get -y purge zlib1g-dev libmemcached-dev \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Enable ZIP
RUN apt-get -y update \
&& apt-get -y install build-essential libzip4 libzip-dev libpng16-16 libpng-dev libbz2-dev zlib1g-dev libgmp-dev libjpeg62-turbo libjpeg-dev libfreetype6 libfreetype6-dev --no-install-recommends \
&& docker-php-ext-configure gd --with-freetype=/usr/include/freetype2 --with-jpeg=/usr/include/ \
&& docker-php-ext-install -j$(nproc) zip bz2 gd \
&& apt-get purge -y build-essential libzip-dev zlib1g-dev libpng-dev libbz2-dev zlib1g-dev libgmp-dev libjpeg-dev libfreetype6-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/*
COPY init /sbin/
RUN chmod 550 /sbin/init && chown 0:0 /sbin/init
ENTRYPOINT [ "/sbin/init" ]
CMD [ "php-fpm" ]