php/Dockerfile
2021-03-03 13:53:44 +11:00

43 lines
1.5 KiB
Docker

# NAME leenooks/php
# VERSION 8.0-fpm-mp
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
EXPOSE 22/tcp
# Add composer
RUN curl https://getcomposer.org/installer|php -- --install-dir=/usr/local/bin --filename=composer
# 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 pecl install -o -f igbinary && pecl install -o -f redis && docker-php-ext-enable redis igbinary && rm -rf /tmp/*
COPY init /sbin/
RUN chmod 550 /sbin/init && chown 0:0 /sbin/init
ENTRYPOINT [ "/sbin/init" ]
CMD [ "php-fpm" ]