├── index.php
├── 999-php.ini
├── 99-xdebug.ini.disabled
├── README.md
├── start
└── Dockerfile
/index.php:
--------------------------------------------------------------------------------
1 | /usr/local/etc/php/conf.d/timezone.ini
7 |
8 | # Configure Apache Document Root
9 | mkdir -p $APACHE_DOC_ROOT
10 | chown www-data:www-data $APACHE_DOC_ROOT
11 | sed -i "s|DocumentRoot /var/www/html\$|DocumentRoot $APACHE_DOC_ROOT|" /etc/apache2/sites-available/000-default.conf
12 | echo "" > /etc/apache2/conf-available/document-root-directory.conf
13 | echo " AllowOverride All" >> /etc/apache2/conf-available/document-root-directory.conf
14 | echo " Require all granted" >> /etc/apache2/conf-available/document-root-directory.conf
15 | echo "" >> /etc/apache2/conf-available/document-root-directory.conf
16 | a2enconf "document-root-directory.conf"
17 |
18 | # Set ServerName Directive
19 | echo "ServerName $APACHE_SERVER_NAME" > /etc/apache2/conf-available/server-name.conf
20 | a2enconf "server-name.conf"
21 |
22 |
23 | # Enable XDebug if needed
24 | if [ "$XDEBUG_ENABLE" = "1" ]; then
25 | docker-php-ext-enable xdebug
26 | mv /usr/local/etc/php/conf.d/99-xdebug.ini.disabled /usr/local/etc/php/conf.d/99-xdebug.ini
27 | # Configure XDebug remote host
28 | if [ -z "$HOST_IP" ]; then
29 | # Allows to set HOST_IP by env variable because could be different from the one which come from ip route command
30 | HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }')
31 | fi;
32 | echo "xdebug.remote_host=$HOST_IP" > /usr/local/etc/php/conf.d/xdebug_remote_host.ini
33 | fi;
34 |
35 | # Configure sSMTP
36 | if [ "$SSMTP_MAILHUB" ]; then
37 | echo "mailhub=$SSMTP_MAILHUB" >> /etc/ssmtp/ssmtp.conf
38 | fi;
39 | if [ "$SSMTP_AUTH_USER" ]; then
40 | echo "AuthUser=$SSMTP_AUTH_USER" >> /etc/ssmtp/ssmtp.conf
41 | fi;
42 | if [ "$SSMTP_AUTH_PASS" ]; then
43 | echo "AuthPass=$SSMTP_AUTH_PASS" >> /etc/ssmtp/ssmtp.conf
44 | fi;
45 |
46 | exec "apache2-foreground"
47 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:8.0-apache
2 | MAINTAINER Webgriffe Srl
3 |
4 | # Install GD
5 | RUN apt-get update \
6 | && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng16-16 \
7 | && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
8 | && docker-php-ext-install gd
9 |
10 | # Install MCrypt
11 | RUN apt-get update \
12 | && apt-get install -y libmcrypt-dev \
13 | && pecl install mcrypt-1.0.4 \
14 | && docker-php-ext-enable mcrypt
15 |
16 | # Install Intl
17 | RUN apt-get update \
18 | && apt-get install -y libicu-dev \
19 | && docker-php-ext-install intl
20 |
21 | ENV XDEBUG_ENABLE 0
22 | RUN pecl config-set preferred_state beta \
23 | && pecl install -o -f xdebug-3.0.0 \
24 | && rm -rf /tmp/pear \
25 | && pecl config-set preferred_state stable
26 | COPY ./99-xdebug.ini.disabled /usr/local/etc/php/conf.d/
27 |
28 | # Install Mysql
29 | RUN docker-php-ext-install mysqli pdo_mysql
30 |
31 | # Install Composer
32 | RUN curl -sS https://getcomposer.org/installer | php \
33 | && mv composer.phar /usr/local/bin/composer
34 |
35 | # Install Oniguruma
36 | RUN apt-get update \
37 | && apt-get install -y libonig-dev
38 |
39 | # Install mbstring
40 | RUN docker-php-ext-install mbstring
41 |
42 | # Install soap
43 | RUN apt-get update \
44 | && apt-get install -y libxml2-dev \
45 | && docker-php-ext-install soap
46 |
47 | # Install opcache
48 | RUN docker-php-ext-install opcache
49 |
50 | # Install PHP zip extension
51 | RUN apt-get update \
52 | && apt-get install -y libzip-dev \
53 | && docker-php-ext-install zip
54 |
55 | # Install Git
56 | RUN apt-get update \
57 | && apt-get install -y git
58 |
59 | # Install xsl
60 | RUN apt-get update \
61 | && apt-get install -y libxslt-dev \
62 | && docker-php-ext-install xsl
63 |
64 | # Define PHP_TIMEZONE env variable
65 | ENV PHP_TIMEZONE Europe/Rome
66 |
67 | # Configure Apache Document Root
68 | ENV APACHE_DOC_ROOT /var/www/html
69 |
70 | # Configure Apache ServerName
71 | ENV APACHE_SERVER_NAME localhost
72 |
73 | # Enable Apache mod_rewrite
74 | RUN a2enmod rewrite
75 |
76 | # Additional PHP ini configuration
77 | COPY ./999-php.ini /usr/local/etc/php/conf.d/
78 |
79 | COPY ./index.php /var/www/html/index.php
80 |
81 | # Install ssmtp Mail Transfer Agent
82 | RUN apt-get update \
83 | && apt-get install -y ssmtp \
84 | && apt-get clean \
85 | && echo "FromLineOverride=YES" >> /etc/ssmtp/ssmtp.conf \
86 | && echo 'sendmail_path = "/usr/sbin/ssmtp -t"' > /usr/local/etc/php/conf.d/mail.ini
87 |
88 | # Install imap
89 | RUN apt-get update \
90 | && apt-get install -y libc-client-dev libkrb5-dev \
91 | && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
92 | && docker-php-ext-install imap
93 |
94 | # Install MySQL CLI Client
95 | RUN apt-get update \
96 | && apt-get install -y default-mysql-client
97 |
98 | ########################################################################################################################
99 |
100 | # Start!
101 | COPY ./start /usr/local/bin/
102 | CMD ["start"]
103 |
--------------------------------------------------------------------------------