-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathDockerfile-debian.template
More file actions
129 lines (118 loc) · 3.31 KB
/
Dockerfile-debian.template
File metadata and controls
129 lines (118 loc) · 3.31 KB
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
FROM php:{{ env.phpVersion }}-{{ env.distribution }}
LABEL org.opencontainers.image.source=https://github.com/espocrm/espocrm
LABEL org.opencontainers.image.description="EspoCRM is a free and open-source CRM platform."
# Persistent dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
unzip \
libldap-common \
; \
rm -rf /var/lib/apt/lists/*
# Install PHP libs
RUN set -eux; \
\
aptMarkList="$(apt-mark showmanual)"; \
\
apt-get update; \
# Install php libs
apt-get install -y --no-install-recommends \
libpq-dev \
libpng-dev \
libjpeg-dev \
libwebp-dev \
libfreetype6-dev \
libzip-dev \
libxml2-dev \
libldap2-dev \
libzmq5-dev \
zlib1g-dev \
; \
\
# Install php-zmq
cd /usr; \
curl -fSL https://github.com/zeromq/php-zmq/archive/616b6c64ffd3866ed038615494306dd464ab53fc.tar.gz -o php-zmq.tar.gz; \
tar -zxf php-zmq.tar.gz; \
cd php-zmq*; \
phpize && ./configure; \
make; \
make install; \
cd .. && rm -rf php-zmq*; \
# END: Install php-zmq
\
pecl install \
ev \
redis \
; \
\
docker-php-ext-configure ldap \
--with-libdir="lib/$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
; \
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg=/usr \
--with-webp \
; \
\
docker-php-ext-install -j$(nproc) \
gd \
pdo_pgsql \
pdo_mysql \
zip \
ldap \
exif \
pcntl \
posix \
bcmath \
; \
docker-php-ext-enable \
zmq \
ev \
redis \
; \
\
rm -r /tmp/pear; \
\
# reset a list of apt-mark
apt-mark auto '.*' > /dev/null; \
apt-mark manual $aptMarkList; \
ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' \
| sort -u \
| xargs -r dpkg-query -S \
| 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/*
# php.ini
RUN { \
echo 'expose_php = Off'; \
echo 'error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED'; \
echo 'display_errors = Off'; \
echo 'display_startup_errors = Off'; \
echo 'log_errors = On'; \
echo 'memory_limit=256M'; \
echo 'max_execution_time=180'; \
echo 'max_input_time=180'; \
echo 'post_max_size=50M'; \
echo 'upload_max_filesize=50M'; \
echo 'date.timezone=UTC'; \
} > ${PHP_INI_DIR}/conf.d/espocrm.ini
{{ if env.variant == "apache" then ( -}}
RUN set -eux; \
a2enmod rewrite
{{ ) else "" end -}}
ENV ESPOCRM_VERSION {{ .version }}
ENV ESPOCRM_SHA256 {{ .sha256 }}
WORKDIR /var/www/html
RUN set -eux; \
curl -fSL "{{ .downloadUrl }}" -o EspoCRM.zip; \
echo "${ESPOCRM_SHA256} *EspoCRM.zip" | sha256sum -c -; \
unzip -q EspoCRM.zip -d /usr/src; \
mv "/usr/src/EspoCRM-${ESPOCRM_VERSION}" /usr/src/espocrm; \
rm EspoCRM.zip
COPY ./docker-*.sh /usr/local/bin/
ENTRYPOINT [ "docker-entrypoint.sh" ]
CMD {{ [ if env.variant == "apache" then "apache2-foreground" else "php-fpm" end ] | @json }}