-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile-debian.template
75 lines (67 loc) · 2.44 KB
/
Dockerfile-debian.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM php:8.1-%%VARIANT%%
LABEL maintainer="David Goodwin <[email protected]> (@DavidGoodwin)"
# docker-entrypoint.sh dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
gosu \
; \
rm -rf /var/lib/apt/lists/*
# Install required PHP extensions
RUN set -ex; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get update; \
apt-get install -y --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 \
; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*
ARG POSTFIXADMIN_VERSION=3.3.13
ARG POSTFIXADMIN_SHA512=bf7daaa089ee3adc4b557f1a7d0509d78979ef688fb725bab795f5c9d81e8774296245fde0cb184db51e9185cad381682c3ecc0bfadf852388b499a0a95cca64
ENV POSTFIXADMIN_VERSION $POSTFIXADMIN_VERSION
ENV POSTFIXADMIN_SHA512 $POSTFIXADMIN_SHA512
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
RUN set -eu; sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf; \
sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
RUN set -eu; \
curl -fsSL -o postfixadmin.tar.gz "https://github.com/postfixadmin/postfixadmin/archive/postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz"; \
echo "$POSTFIXADMIN_SHA512 *postfixadmin.tar.gz" | sha512sum -c -; \
# upstream tarball include ./postfixadmin-postfixadmin-${POSTFIXADMIN_VERSION}/
mkdir /usr/src/postfixadmin; \
tar -xf postfixadmin.tar.gz -C /usr/src/postfixadmin --strip-components=1; \
rm postfixadmin.tar.gz; \
# Does not exist in tarball but is required
mkdir -p /usr/src/postfixadmin/templates_c; \
chown -R www-data:www-data /usr/src/postfixadmin
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["%%CMD%%"]