forked from Turgon37/docker-glpi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile_nginx-82
155 lines (135 loc) · 4.21 KB
/
Dockerfile_nginx-82
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
# 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}"
# Second stage : build final image
FROM php:8.2-fpm-alpine
LABEL maintainer='Michał Panasiewicz <[email protected]>'
ARG GLPI_VERSION
ARG PHP_XDEBUG
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_XDEBUG "${PHP_XDEBUG}"
ENV PHP_UPLOAD_MAX_FILESIZE 16m
ENV PHP_MAX_EXECUTION_TIME 3600
ENV PHP_POST_MAX_SIZE 20M
ENV PHP_OPCACHE_MEM_CONSUMPTION 256
ENV PHP_MEMORY_LIMIT 64M
ENV PHP_MAX_INPUT_VARS 3000
ENV PHPFPM_PM dynamic
ENV PHPFPM_PM_MAX_CHILDREN 30
ENV PHPFPM_PM_START_SERVERS 4
ENV PHPFPM_PM_MIN_SPARE_SERVERS 4
ENV PHPFPM_PM_MAX_SPARE_SERVERS 8
ENV PHPFPM_PM_PROCESS_IDLE_TIMEOUT 120s
ENV PHPFPM_PM_MAX_REQUEST 2000
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
# Install dependencies
RUN set -ex; \
PHP_XDEBUG=$(echo "${PHP_XDEBUG}" | tr '[:upper:]' '[:lower:]') ; \
apk --no-cache add \
curl \
nginx \
fping \
graphviz \
iputils \
net-snmp-libs \
py3-jinja2 \
py3-pip \
supervisor \
tar \
tzdata \
; \
pip3 install --break-system-packages \
jinjanator \
; \
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 \
libzip-dev \
libpng-dev \
net-snmp-dev \
openldap-dev \
pcre-dev \
imagemagick-dev \
; \
docker-php-source extract ; \
docker-php-ext-configure gd --with-freetype=/usr --with-jpeg=/usr; \
docker-php-ext-configure ldap ; \
docker-php-ext-install \
bz2 \
exif \
gd \
imap \
intl \
ldap \
mysqli \
opcache \
snmp \
soap \
zip \
; \
pecl install apcu && docker-php-ext-enable apcu ; \
pecl install xmlrpc-1.0.0RC3 && docker-php-ext-enable xmlrpc ; \
if [[ "$PHP_XDEBUG" = "yes" ]] ; then \
pecl install xdebug-3.2.1 && docker-php-ext-enable xdebug ; \
else \
echo "PHP_XDEBUG is not build - set $PHP_XDEBUG" ; \
fi ; \
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
RUN rm -f /usr/local/etc/php-fpm.d/*
RUN rm -f /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/conf.d/default.conf
RUN rm -f /usr/local/etc/php-fpm.conf
# Copy glpi build
COPY --from=build_glpi --chown=www-data:www-data ${GLPI_PATHS_ROOT} ${GLPI_PATHS_ROOT}
# Add some configurations files
RUN if [[ "$PHP_XDEBUG" = "yes" ]] ; then \
echo "Xdebug is on"; \
else \
rm -f root\etc\php-fpm.d\xdebug.conf.j2 ; \
fi ;
COPY root/ /
COPY /docker-entrypoint.sh /
COPY /docker-entrypoint.d/* /docker-entrypoint.d/
COPY /php-fpm.conf /usr/local/etc/php-fpm.conf
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"]