-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathDockerfile_nginx-72
139 lines (122 loc) · 3.83 KB
/
Dockerfile_nginx-72
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
# First stage : download glpi + build it
FROM composer:latest as build_glpi
ARG GLPI_VERSION
ARG GLPI_PATHS_ROOT=/var/www
RUN mkdir -p "${GLPI_PATHS_ROOT}"
RUN curl -v --fail -o glpi.tgz -L "https://github.com/glpi-project/glpi/releases/download/${GLPI_VERSION}/glpi-${GLPI_VERSION}.tgz" \
&& tar -xzf glpi.tgz --strip 1 --directory ${GLPI_PATHS_ROOT}
WORKDIR "${GLPI_PATHS_ROOT}"
RUN curl --silent --show-error --fail --remote-name-all \
https://raw.githubusercontent.com/glpi-project/glpi/${GLPI_VERSION}/composer.json \
https://raw.githubusercontent.com/glpi-project/glpi/${GLPI_VERSION}/composer.lock \
&& COMPOSER_HOME=/tmp/composer composer require \
--apcu-autoloader \
--classmap-authoritative \
--ignore-platform-reqs \
--no-interaction \
--no-progress \
--optimize-autoloader \
--prefer-dist \
--update-no-dev \
--working-dir ${GLPI_PATHS_ROOT} \
apereo/phpcas \
&& rm -fv composer.json
# Second stage : build final image
FROM php:7.2-fpm-alpine3.11
LABEL maintainer='Pierre GINDRAUD <[email protected]>'
ARG GLPI_VERSION
ENV GLPI_VERSION "${GLPI_VERSION}"
ENV GLPI_PATHS_ROOT /var/www
ENV GLPI_PATHS_PLUGINS /var/www/plugins
ENV GLPI_REMOVE_INSTALLER no
ENV GLPI_CHMOD_PATHS_FILES no
ENV GLPI_INSTALL_PLUGINS ''
ENV PHP_MEMORY_LIMIT 64M
ENV PHPFPM_PM dynamic
ENV PHPFPM_PM_MAX_CHILDREN 5
ENV PHPFPM_PM_START_SERVERS 2
ENV PHPFPM_PM_MIN_SPARE_SERVERS 1
ENV PHPFPM_PM_MAX_SPARE_SERVERS 3
ENV PHPFPM_PM_PROCESS_IDLE_TIMEOUT 10s
ENV PHPFPM_PM_MAX_REQUEST 500
# Install dependencies
RUN set -ex; \
apk --no-cache add \
curl \
nginx \
fping \
graphviz \
iputils \
net-snmp-libs \
py3-jinja2 \
supervisor \
tar \
tzdata \
; \
pip3 install \
j2cli \
; \
apk add --no-cache --virtual .build-deps \
$PHPIZE_DEPS \
autoconf \
bzip2-dev \
coreutils \
curl-dev \
freetype-dev \
icu-dev \
imap-dev \
libevent-dev \
libjpeg-turbo-dev \
libmcrypt-dev \
libpng-dev \
libxml2-dev \
net-snmp-dev \
openldap-dev \
pcre-dev \
imagemagick-dev \
; \
docker-php-source extract ; \
docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr; \
docker-php-ext-configure ldap ; \
docker-php-ext-install \
bz2 \
exif \
gd \
imap \
intl \
ldap \
mysqli \
opcache \
snmp \
soap \
xmlrpc \
zip \
; \
pecl install apcu && docker-php-ext-enable apcu ; \
docker-php-source delete ; \
runDeps="$( \
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
| tr ',' '\n' \
| sort -u \
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
)"; \
apk add --virtual .nextcloud-phpext-rundeps $runDeps; \
apk del .build-deps ; \
mkdir -p /run/nginx ; \
find "${GLPI_PATHS_ROOT}" -mindepth 1 -maxdepth 1 -not -name '.*' -and -not -name '..' | xargs rm -rfv
# Copy glpi build
COPY --from=build_glpi --chown=www-data:www-data ${GLPI_PATHS_ROOT} ${GLPI_PATHS_ROOT}
# Add some configurations files
COPY root/ /
COPY /docker-entrypoint.sh /
COPY /docker-entrypoint.d/* /docker-entrypoint.d/
RUN chmod -R +x /docker-entrypoint.d/ /usr/local/bin/cronwrapper.py \
&& chmod -R g=rX,o=--- /var/www/* \
&& addgroup nginx www-data
EXPOSE 80/tcp
VOLUME ["/var/www/files", "/var/www/config"]
WORKDIR "${GLPI_PATHS_ROOT}"
HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
CMD curl --silent http://127.0.0.1:80/fpm-ping | grep -q pong || exit 1
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/bin/supervisord", "--configuration", "/etc/supervisord.conf"]