php8/Dockerfile

83 lines
3.2 KiB
Docker

FROM debian:buster-slim
LABEL nl.rug.webhosting.version="0.1.9" nl.rug.webhosting.release-date="2021-01-04" nl.rug.webhosting.version.is-production="true"
# ONBUILD apt-get update && apt-get upgrade -y
ENV DEBIAN_FRONTEND noninteractive
RUN export LANG=en_US.UTF-8 \
&& apt-get update && apt-get install --no-install-recommends -y wget curl apt-transport-https ca-certificates gnupg2 \
&& wget -4 --no-check-certificate https://packages.microsoft.com/keys/microsoft.asc -O /tmp/microsoft.asc \
&& cat /tmp/microsoft.asc | apt-key add - \
&& wget --no-check-certificate -q https://packages.sury.org/php/apt.gpg -O- | apt-key add - \
&& curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
&& echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/php.list \
&& apt-get update && apt-get upgrade -y \
&& ACCEPT_EULA=Y apt-get -y install --no-install-recommends msodbcsql17 php8.0 php8.0-xml php8.0-cli php8.0-common php8.0-curl php8.0-mbstring php8.0-mysql \
php8.0-xml apache2 php8.0-mysqli libimage-exiftool-perl imagemagick \
libapache2-mod-php8.0 ghostscript libimage-exiftool-perl libodbc1 odbcinst1debian2 php8.0-odbc \
php-pear nano ruby locales cron logrotate mailutils msmtp msmtp-mta && \
apt-get autoclean && \
apt-get clean
RUN apt-get -y install --no-install-recommends make g++ gcc php8.0-dev unixodbc-dev
RUN pecl channel-update pecl.php.net \
&& pecl install sqlsrv \
&& pecl install pdo_sqlsrv \
&& pecl install pecl mongodb \
&& printf "; priority=20\nextension=sqlsrv.so\n" > /etc/php/8.0/mods-available/sqlsrv.ini \
&& printf "; priority=30\nextension=pdo_sqlsrv.so\n" > /etc/php/8.0/mods-available/pdo_sqlsrv.ini \
&& printf "; priority=40\nextension=pdo_mongodb.so\n" > /etc/php/8.0/mods-available/pdo_mongodb.ini \
&& phpenmod sqlsrv pdo_sqlsrv mongodb
RUN apt-get remove make g++ gcc php8.0-dev unixodbc-dev -y \
&& apt-get autoremove -y
RUN a2enmod headers \
&& a2enmod rewrite \
&& a2enmod proxy \
&& a2enmod remoteip \
&& a2enmod expires \
&& a2enmod proxy_fcgi \
&& a2dismod status \
&& a2dissite 000-default \
&& rm /etc/localtime \
&& ln -s /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime \
&& echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
&& echo "nl_NL.UTF-8 UTF-8" >> /etc/locale.gen \
&& locale-gen \
&& echo "TLS_REQCERT never" >> /etc/ldap/ldap.conf
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
APACHE_RUN_USER=www-data \
APACHE_RUN_GROUP=www-data \
APACHE_CGI_DIR=/home/www/cgi-bin \
APACHE_LOG_DIR=/home/www/log \
APACHE_SERVERADMIN=webhosting.cit@rug.nl \
APACHE_SERVERNAME=localhost \
APACHE_SERVER_NAME=localhost \
APACHE_SERVERALIAS=web.rug.nl \
APACHE_DOCUMENTROOT=/home/www/site \
APACHE_CRON_DIR=/home/www/crons \
APACHE_HOME_DIR=/home/www \
APACHE_RUN_DIR=/var/run/apache2 \
APACHE_PID_FILE=/var/run/apache2/apache2.pid \
APACHE_LOCK_DIR=/var/lock/apache2 \
PHP_MEMORY_LIMIT="512M"
RUN env
RUN mkdir -p $APACHE_RUN_DIR DIR $APACHE_LOCK_DIR
ADD ./conf /
WORKDIR /home/www
RUN chmod +x /start.sh
ENTRYPOINT ["/start.sh"]
CMD ["apache2", "-DFOREGROUND"]