2021-08-30 16:09:14 +00:00
|
|
|
FROM docker.io/library/php:7.4-apache
|
|
|
|
|
|
|
|
# POSTFIXADMIN VERSION
|
2022-01-30 15:21:23 +00:00
|
|
|
ARG POSTFIXADMIN_VERSION
|
2021-08-30 16:09:14 +00:00
|
|
|
|
|
|
|
# APACHE
|
|
|
|
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
|
|
|
|
|
|
|
|
RUN set -eu; \
|
|
|
|
sed --in-place --regexp-extended 's#/var/www/html#${APACHE_DOCUMENT_ROOT}#g' /etc/apache2/sites-available/*.conf; \
|
|
|
|
sed --in-place --regexp-extended 's#/var/www/#${APACHE_DOCUMENT_ROOT}#g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
|
|
|
|
|
|
|
|
# DEFAULT DATABASE SETTINGS
|
|
|
|
ENV POSTFIXADMIN_DATABASE_TYPE=sqlite \
|
|
|
|
POSTFIXADMIN_DATABASE_HOST="" \
|
|
|
|
POSTFIXADMIN_DATABASE_PORT="" \
|
|
|
|
POSTFIXADMIN_DATABASE_USER="" \
|
|
|
|
POSTFIXADMIN_DATABASE_PASSWORD="" \
|
|
|
|
POSTFIXADMIN_SMTP_SERVER="localhost" \
|
|
|
|
POSTFIXADMIN_SMTP_PORT="25" \
|
|
|
|
POSTFIXADMIN_ENCRYPT="md5crypt"
|
|
|
|
|
|
|
|
# docker-entrypoint.sh dependencies
|
|
|
|
RUN set -eux; \
|
|
|
|
apt-get update; \
|
2021-09-03 14:32:54 +00:00
|
|
|
apt-get install --yes --no-install-recommends gosu apache2-utils; \
|
2021-08-30 16:09:14 +00:00
|
|
|
rm --recursive --force /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install required PHP extensions
|
|
|
|
RUN set -ex; \
|
2021-09-10 19:15:08 +00:00
|
|
|
savedAptMark="$(apt-mark showmanual)"; \
|
|
|
|
apt-get update; \
|
|
|
|
apt-get install --yes --no-install-recommends \
|
|
|
|
libc-client2007e-dev \
|
|
|
|
libkrb5-dev \
|
|
|
|
libpq-dev \
|
|
|
|
libsqlite3-dev; \
|
|
|
|
docker-php-ext-configure imap --with-imap-ssl --with-kerberos; \
|
|
|
|
docker-php-ext-install -j "$(nproc)" \
|
|
|
|
imap \
|
|
|
|
pdo_mysql \
|
|
|
|
pdo_pgsql \
|
|
|
|
pdo_sqlite \
|
|
|
|
pgsql; \
|
|
|
|
apt-mark auto '.*' > /dev/null; \
|
|
|
|
apt-mark manual $savedAptMark; \
|
|
|
|
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
|
|
|
|
| awk '/=>/ { print $3 }' \
|
|
|
|
| sort -u \
|
|
|
|
| xargs -r dpkg-query -S \
|
|
|
|
| cut -d: -f1 \
|
|
|
|
| sort -u \
|
|
|
|
| xargs -rt apt-mark manual; \
|
|
|
|
if [ ! -z ${POSTFIXADMIN_VERSION} ]; then \
|
|
|
|
curl --fail --silent --show-error --location "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz" --output postfixadmin.tar.gz; \
|
|
|
|
tar --extract --file postfixadmin.tar.gz --directory /var/www/html --strip-components=1; \
|
|
|
|
rm postfixadmin.tar.gz; \
|
|
|
|
else \
|
|
|
|
apt-get install --yes git; \
|
|
|
|
git clone https://github.com/postfixadmin/postfixadmin.git /var/www/html; \
|
|
|
|
fi; \
|
|
|
|
apt-get purge --yes --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
|
|
|
|
rm --recursive --force /var/lib/apt/lists/*
|
2021-08-30 16:09:14 +00:00
|
|
|
|
2021-09-10 19:15:08 +00:00
|
|
|
RUN mkdir --parents /var/www/html/templates_c; \
|
|
|
|
chown --recursive www-data:www-data /var/www/html
|
2021-08-30 16:09:14 +00:00
|
|
|
|
|
|
|
COPY entrypoint.sh /usr/local/bin/
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
|
CMD ["apache2-foreground"]
|