-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
166 lines (149 loc) · 5.24 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
163
164
165
166
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /Dockerfile.tmpl.php
# https://hub.docker.com/_/php
FROM php:8.2-apache
ARG roundcube_ver=1.5.9
ARG s6_overlay_ver=3.2.0.2
# Install s6-overlay
RUN curl -fL -o /tmp/s6-overlay-noarch.tar.xz \
https://github.com/just-containers/s6-overlay/releases/download/v${s6_overlay_ver}/s6-overlay-noarch.tar.xz \
&& curl -fL -o /tmp/s6-overlay-bin.tar.xz \
https://github.com/just-containers/s6-overlay/releases/download/v${s6_overlay_ver}/s6-overlay-x86_64.tar.xz \
&& tar -xf /tmp/s6-overlay-noarch.tar.xz -C / \
&& tar -xf /tmp/s6-overlay-bin.tar.xz -C / \
&& rm -rf /tmp/*
ENV S6_KEEP_ENV=1 \
S6_BEHAVIOUR_IF_STAGE2_FAILS=2 \
S6_CMD_WAIT_FOR_SERVICES=1 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=5000
# Install required libraries and PHP extensions
RUN apt-get update \
&& apt-get upgrade -y \
&& update-ca-certificates \
&& apt-get install -y --no-install-recommends --no-install-suggests \
inetutils-syslogd \
gnupg \
&& apt-get install -y --no-install-recommends --no-install-suggests \
libpq5 libodbc1 libsybdb5 \
libaspell15 \
libicu72 \
libldap-2.5-0 libsasl2-2 \
libjpeg62-turbo libpng16-16 libfreetype6 \
libzip4 \
\
&& buildDeps=" \
libpq-dev unixodbc-dev freetds-dev \
libpspell-dev \
libicu-dev \
libldap2-dev \
libjpeg62-turbo-dev libpng-dev libfreetype6-dev \
libzip-dev \
" \
&& apt-get install -y --no-install-recommends --no-install-suggests \
$buildDeps \
\
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu \
&& docker-php-ext-configure pdo_dblib --with-libdir=lib/x86_64-linux-gnu \
&& docker-php-ext-configure gd --with-jpeg=/usr/include/ \
--with-freetype=/usr/include/ \
&& docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
&& docker-php-ext-install \
exif \
gd \
intl \
ldap \
opcache \
pdo_mysql pdo_pgsql pdo_odbc pdo_dblib \
pspell \
sockets \
zip \
\
&& a2enmod expires \
headers \
rewrite \
\
# Cleanup stuff
&& apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$buildDeps \
&& rm -rf /var/lib/apt/lists/*
# Install Roundcube
RUN curl -fL -o /tmp/roundcube.tar.gz \
https://github.com/roundcube/roundcubemail/releases/download/${roundcube_ver}/roundcubemail-${roundcube_ver}.tar.gz \
&& tar -xzf /tmp/roundcube.tar.gz -C /tmp/ \
&& rm -rf /app \
&& mv /tmp/roundcubemail-${roundcube_ver} /app \
\
# Install Composer to resolve Roundcube dependencies
&& curl -fL -o /tmp/composer-setup.php \
https://getcomposer.org/installer \
&& curl -fL -o /tmp/composer-setup.sig \
https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { echo 'Invalid installer' . PHP_EOL; exit(1); }" \
&& php /tmp/composer-setup.php --install-dir=/tmp --filename=composer \
\
# Install tools for building
&& apt-get update \
&& toolDeps=" \
git \
unzip \
" \
&& apt-get install -y --no-install-recommends --no-install-suggests \
$toolDeps \
\
# Resolve Roundcube Composer dependencies
&& mv /app/composer.json-dist /app/composer.json \
&& cd /app/ \
&& (/tmp/composer suggests --list | xargs -i /tmp/composer require {}) \
&& /tmp/composer install --no-dev --optimize-autoloader --no-progress \
\
# Resolve Roundcube JS dependencies
&& /app/bin/install-jsdeps.sh \
\
# Make default Roundcube configuration log to syslog
&& sed -i -r 's/^([^\s]{9}log_driver[^\s]{2} =) [^\s]+$/\1 "syslog";/g' \
/app/config/defaults.inc.php \
\
# Setup serve directories
&& cd /app/ \
&& ln -sn ./public_html /app/html \
&& rm -rf /var/www \
&& ln -s /app /var/www \
\
# Set correct owner
&& chown -R www-data:www-data /app /var/www \
\
# Cleanup stuff
&& (find /app/ -name .travis.yml -type f -prune | \
while read d; do rm -rf $d; done) \
&& (find /app/ -name .gitignore -type f -prune | \
while read d; do rm -rf $d; done) \
&& (find /app/ -name .git -type d -prune | \
while read d; do rm -rf $d; done) \
&& (find /app/ -name .github -type d -prune | \
while read d; do rm -rf $d; done) \
&& apt-get purge -y --auto-remove \
-o APT::AutoRemove::RecommendsImportant=false \
$toolDeps \
&& rm -rf /var/lib/apt/lists/* \
/app/temp/* \
/root/.composer \
/tmp/*
# Install configurations
COPY rootfs /
# Fix executable rights
RUN chmod +x /etc/s6-overlay/s6-rc.d/*/run \
/docker-entrypoint.sh \
\
# Fix container entrypoint shell usage
&& sed -i -e 's,^#!/bin/sh,#!/bin/bash,' /docker-entrypoint.sh \
\
# Prepare directory for SQLite database
&& mkdir -p /var/db \
&& chown -R www-data:www-data /var/db
ENV PHP_OPCACHE_REVALIDATION=0 \
PHP_OPCACHE_JIT_BUFFER_SIZE=100M \
SHARE_APP=0
WORKDIR /var/www
ENTRYPOINT ["/init", "/docker-entrypoint.sh"]
CMD ["apache2-foreground"]