-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
148 lines (131 loc) · 4.47 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
# AUTOMATICALLY GENERATED
# DO NOT EDIT THIS FILE DIRECTLY, USE /Dockerfile.tmpl.php
# https://hub.docker.com/_/php
FROM php:8.2-fpm-alpine3.20
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 apk update \
&& apk upgrade \
&& update-ca-certificates \
&& apk add --no-cache --virtual .plugin-deps \
gnupg \
&& apk add --no-cache --virtual .php-ext-deps \
libpq unixodbc freetds \
aspell-libs \
icu-libs \
libldap \
libjpeg-turbo libpng freetype \
libzip \
zlib \
\
&& apk add --no-cache --virtual .build-deps \
linux-headers \
postgresql-dev unixodbc-dev freetds-dev \
aspell-dev \
icu-dev \
openldap-dev \
libjpeg-turbo-dev libpng-dev freetype-dev \
libzip-dev \
zlib-dev \
\
&& 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 \
\
# Cleanup stuff
&& apk del .build-deps \
&& rm -rf /var/cache/apk/*
# 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
&& apk add --update --no-cache --virtual .tool-deps \
git \
file \
\
# 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) \
&& apk del .tool-deps \
&& rm -rf /var/cache/apk/* \
/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 \
\
# 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 ["php-fpm"]