-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
162 lines (150 loc) · 6.7 KB
/
Dockerfile
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# Panubo PHP-Apache
#
# Debian Sid (Unstable)
# PHP 8.1
# Apache 2.4
# Mongo support
#
FROM debian:sid
# Component Versions
ENV \
BASHCONTAINER_VERSION=0.7.2 BASHCONTAINER_SHA256=87c4b804f0323d8f0856cb4fbf2f7859174765eccc8b0ac2d99b767cecdcf5c6 \
PHPEXTRAS_VERSION=0.1.0 PHPEXTRAS_SHA256=515af5789d5180123acfac9b1090f46e07f355c8df51a34e27ada5f7da0495cc
# Change the www-data use to uid and gid 48 to match other containers
RUN \
usermod -u 48 www-data && \
groupmod -g 48 www-data
# Install bash-container functions
RUN set -x \
&& if ! command -v wget > /dev/null; then \
fetchDeps="${fetchDeps} wget"; \
fi \
&& apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl ${fetchDeps} \
&& cd /tmp \
&& wget -nv https://github.com/panubo/bash-container/releases/download/v${BASHCONTAINER_VERSION}/panubo-functions.tar.gz \
&& echo "${BASHCONTAINER_SHA256} panubo-functions.tar.gz" > /tmp/SHA256SUM \
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected $(sha256sum panubo-functions.tar.gz)"; exit 1; )) \
&& tar --no-same-owner -C / -zxf panubo-functions.tar.gz \
&& rm -rf /tmp/* \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${fetchDeps} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
;
# Install gomplate
RUN set -x \
&& GOMPLATE_VERSION=v3.11.5 \
&& GOMPLATE_CHECKSUM_X86_64=16f6a01a0ff22cae1302980c42ce4f98ca20f8c55443ce5a8e62e37fc23487b3 \
&& GOMPLATE_CHECKSUM_AARCH64=fd980f9d233902e50f3f03f10ea65f36a2705385358a87aa18b19fb7cdf54c1d \
&& if [ "$(uname -m)" = "x86_64" ] ; then \
GOMPLATE_CHECKSUM="${GOMPLATE_CHECKSUM_X86_64}"; \
GOMPLATE_ARCH="amd64"; \
elif [ "$(uname -m)" = "aarch64" ]; then \
GOMPLATE_CHECKSUM="${GOMPLATE_CHECKSUM_AARCH64}"; \
GOMPLATE_ARCH="arm64"; \
fi \
&& curl -sSf -o /tmp/gomplate_linux-${GOMPLATE_ARCH} -L https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_linux-${GOMPLATE_ARCH} \
&& echo "${GOMPLATE_CHECKSUM} gomplate_linux-${GOMPLATE_ARCH}" > /tmp/SHA256SUM \
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected $(sha256sum gomplate_linux-${GOMPLATE_ARCH})"; exit 1; )) \
&& install -m 0755 /tmp/gomplate_linux-${GOMPLATE_ARCH} /usr/local/bin/gomplate \
&& rm -f /tmp/* \
;
# Install s6
RUN set -x \
&& S6_VERSION=2.11.0.0 \
&& EXECLINE_VERSION=2.8.1.0 \
&& SKAWARE_RELEASE=2.0.7 \
&& S6_CHECKSUM_X86_64=fcf79204c1957016fc88b0ad7d98f150071483583552103d5822cbf56824cc87 \
&& S6_CHECKSUM_AARCH64=64151e136f887c6c2c7df69e3100573c318ec7400296680cc698bc7b0ca36943 \
&& EXECLINE_CHECKSUM_X86_64=b216cfc4db928729d950df5a354aa34bc529e8250b55ab0de700193693dea682 \
&& EXECLINE_CHECKSUM_AARCH64=8cb1d5c2d44cb94990d63023db48f7d3cd71ead10cbb19c05b99dbd528af5748 \
&& if [ "$(uname -m)" = "x86_64" ] ; then \
S6_CHECKSUM="${S6_CHECKSUM_X86_64}"; \
EXECLINE_CHECKSUM="${EXECLINE_CHECKSUM_X86_64}"; \
SKAWARE_ARCH="amd64"; \
elif [ "$(uname -m)" = "aarch64" ]; then \
S6_CHECKSUM="${S6_CHECKSUM_AARCH64}"; \
EXECLINE_CHECKSUM="${EXECLINE_CHECKSUM_AARCH64}"; \
SKAWARE_ARCH="aarch64"; \
fi \
&& curl -sSf -L -o /tmp/s6-${S6_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz https://github.com/just-containers/skaware/releases/download/v${SKAWARE_RELEASE}/s6-${S6_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz \
&& curl -sSf -L -o /tmp/execline-${EXECLINE_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz https://github.com/just-containers/skaware/releases/download/v${SKAWARE_RELEASE}/execline-${EXECLINE_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz \
&& echo "${S6_CHECKSUM} s6-${S6_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz" > /tmp/SHA256SUM \
&& echo "${EXECLINE_CHECKSUM} execline-${EXECLINE_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz" >> /tmp/SHA256SUM \
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected S6: $(sha256sum s6-${S6_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz) Execline: $(sha256sum execline-${EXECLINE_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz)"; exit 1; )) \
&& tar -C /usr/local -zxf /tmp/s6-${S6_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz \
&& tar -C /usr/local -zxf /tmp/execline-${EXECLINE_VERSION}-linux-${SKAWARE_ARCH}-bin.tar.gz \
&& rm -rf /tmp/* \
;
# Install PHP Extras
RUN set -x \
&& if ! command -v wget > /dev/null; then \
fetchDeps="${fetchDeps} wget"; \
fi \
&& apt-get update \
&& apt-get install -y --no-install-recommends ${fetchDeps} \
&& cd /tmp \
&& wget -nv https://github.com/panubo/php-extras/releases/download/v${PHPEXTRAS_VERSION}/php-extras.tar.gz \
&& echo "${PHPEXTRAS_SHA256} php-extras.tar.gz" > /tmp/SHA256SUM \
&& ( cd /tmp; sha256sum -c SHA256SUM || ( echo "Expected $(sha256sum php-extras.tar.gz)"; exit 1; )) \
&& mkdir -p /usr/share/php/ \
&& tar --no-same-owner -C /usr/share/php/ -zxf php-extras.tar.gz \
&& rm -rf /tmp/* \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${fetchDeps} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
;
# Install main packages
RUN \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y wget curl ca-certificates git gnupg openssh-client msmtp-mta apache2 libapache2-mod-xsendfile imagemagick ghostscript \
php8.1-apcu \
php8.1-cli \
php8.1-curl \
php8.1-dom \
php8.1-fpm \
php8.1-gd \
php8.1-igbinary \
php8.1-imagick \
php8.1-imap \
php8.1-intl \
php8.1-ldap \
php8.1-mbstring \
php8.1-memcached \
php8.1-mongodb \
php8.1-mysql \
php8.1-pgsql \
php8.1-pspell \
php8.1-redis \
php8.1-sqlite \
php8.1-xmlrpc \
php8.1-zip && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/www/html/*
# Configure
RUN \
echo "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config && \
sed -i -e '/^session.save_/ s/^/;/' /etc/php/8.1/*/php.ini && \
touch /etc/php/8.1/mods-available/auto.ini && \
touch /var/log/msmtp.log && \
chown www-data:www-data /var/log/msmtp.log && \
sed -i -r 's/^Listen.*/Listen 8000/g' /etc/apache2/ports.conf && \
sed -i 's/^error_log.*/error_log = \/dev\/stderr/' /etc/php/8.1/fpm/php-fpm.conf && \
sed -i -E 's/^;?systemd_interval.*/systemd_interval = 0/' /etc/php/8.1/fpm/php-fpm.conf && \
mv /etc/php/8.1/fpm/pool.d/www.conf /etc/php/8.1/fpm/pool.d/www.conf_orig && \
mkdir -p /var/log/php-fpm
# Copy configs and templates
COPY etc /etc
COPY root /
# Enable modules / configs
RUN \
phpenmod session mongodb && \
a2dissite 000-default && \
a2disconf security other-vhosts-access-log && \
phpenmod auto && \
a2enconf php8.1-fpm && \
a2enmod proxy_fcgi remoteip rewrite headers
ENV TMPDIR=/var/tmp TERM=dumb
EXPOSE 8000
ENTRYPOINT ["/entry.sh"]
CMD ["s6"]