Skip to content

Commit

Permalink
- png is in php-gd >7.3 as standard
Browse files Browse the repository at this point in the history
- parameters for new version docker-php-ext-configure >php 7.3
- add py3-pip (pip3)
- last alpine version for PHP
- Add Dockerfile_nginx-74 for php 7.4
- sync with Turgon37 repository
  • Loading branch information
Wolvverine committed Jan 28, 2022
1 parent 28891c5 commit ed2e562
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
# READ!!! https://docs.travis-ci.com/user/encryption-keys/#note-on-escaping-certain-symbols
matrix:
# Provide a list of GLPI version to build
- GLPI_VERSION=9.5.7 IMAGE_VARIANT=nginx-74 UPDATE_README=1
- GLPI_VERSION=9.5.7 IMAGE_VARIANT=nginx-72 UPDATE_README=1 UPDATE_LATEST=1
#- GLPI_VERSION=9.5.7 IMAGE_VARIANT=nginx-72 UPDATE_README=1 GLPI_PHP_XDEBUG=yes

Expand All @@ -37,4 +38,4 @@ script:
## Publish
#
- '[ "$TRAVIS_PULL_REQUEST" == "false" ] || exit 0'
- '[ "$TRAVIS_SECURE_ENV_VARS" == "true" -a -f _test_ok ] && ./publish.sh'
- '[ "$TRAVIS_SECURE_ENV_VARS" == "true" -a -f _test_ok ] && ./publish.sh'
3 changes: 2 additions & 1 deletion Dockerfile_nginx-72
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ RUN curl --silent --show-error --fail --remote-name-all \
&& rm -fv composer.json

# Second stage : build final image
FROM php:7.2-fpm-alpine3.11
FROM php:7.2-fpm-alpine

LABEL maintainer='Pierre GINDRAUD <[email protected]>'

Expand Down Expand Up @@ -63,6 +63,7 @@ RUN set -ex; \
iputils \
net-snmp-libs \
py3-jinja2 \
py3-pip \
supervisor \
tar \
tzdata \
Expand Down
157 changes: 157 additions & 0 deletions Dockerfile_nginx-74
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# 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 \
--no-suggest \
--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.4-fpm-alpine

LABEL maintainer='Pierre GINDRAUD <[email protected]>'

ARG GLPI_VERSION
ARG GLPI_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 "${GLPI_PHP_XDEBUG}"

ENV PHP_MEMORY_LIMIT 64M

ENV PHPFPM_PM dynamic
ENV PHPFPM_PM_MAX_CHILDREN 20
ENV PHPFPM_PM_START_SERVERS 4
ENV PHPFPM_PM_MIN_SPARE_SERVERS 2
ENV PHPFPM_PM_MAX_SPARE_SERVERS 4
ENV PHPFPM_PM_PROCESS_IDLE_TIMEOUT 20s
ENV PHPFPM_PM_MAX_REQUEST 1000

# Install dependencies
RUN set -ex; \
apk --no-cache add \
curl \
nginx \
fping \
graphviz \
iputils \
net-snmp-libs \
py3-jinja2 \
py3-pip \
supervisor \
tar \
tzdata \
; \
pip3 install \
j2cli \
jinja2-getenv-extension \
; \
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 \
xmlrpc \
zip \
; \
pecl install apcu && docker-php-ext-enable apcu ; \
if [[ "$GLPI_PHP_XDEBUG" = "yes" ]] ; then \
pecl install xdebug-3.0.0 && docker-php-ext-enable xdebug ; \
else \
echo "PHP_XDEBUG is not build" ; \
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

# Copy glpi build
COPY --from=build_glpi --chown=www-data:www-data ${GLPI_PATHS_ROOT} ${GLPI_PATHS_ROOT}

# Add some configurations files
RUN if [[ "$GLPI_PHP_XDEBUG" = "yes" ]] ; then \
echo "Xdebug is on"; \
else \
rm -f root\etc\php-fpm.d\xdebug.ini.j2 ; \
fi ;

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"]
2 changes: 1 addition & 1 deletion publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ publish=false
if [[ "${VCS_BRANCH}" == "${PRODUCTION_BRANCH}" ]]; then
image_tags=("${image_tags_prefix}${application_version}-${image_version}")
if [[ -z "${GLPI_VERSION}" || -n "${UPDATE_LATEST}" ]]; then
image_tags+=("${image_tags_prefix}latest" "${image_tags_prefix}${application_version}-latest")
image_tags+=("${image_tags_prefix}latest" "${image_tags_prefix}${application_version}-latest" "latest")
fi
if ! curl -s "https://hub.docker.com/v2/repositories/${username}/${repo}/tags/?page_size=100" \
| grep --quiet "\"name\": *\"${image_tags_prefix}${application_version}-${image_version}\""; then
Expand Down
7 changes: 6 additions & 1 deletion root/etc/php-fpm.d/custom.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ session.auto_start=off
session.use_trans_sid=0
display_errors=off
display_startup_errors=On
memory_limit={{ env('PHP_MEMORY_LIMIT') }}
{#
{% if "{% raw %}{{ 'PHPFPM_DECORATE_WORKERS_OUTPUT'|getenv('') }}{% endraw %}" %}
decorate_workers_output={{ env('PHPFPM_DECORATE_WORKERS_OUTPUT') }}
{% endif %}
#}
memory_limit={{ env('PHP_MEMORY_LIMIT') }}
2 changes: 1 addition & 1 deletion root/usr/local/bin/cronwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ def filterOutputString(string):
sys.stdout.write(json.dumps(log)+'\n')
if args.forward_stderr and len(log['stderr']):
sys.stderr.write(log['stderr']+'\n')
sys.exit(0)
sys.exit(0)
4 changes: 2 additions & 2 deletions tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fi

# Download tools shim.
if [[ ! -f _tools.sh ]]; then
curl -L -o "${PWD}/_tools.sh" https://gist.githubusercontent.com/Wolvverine/cd03f29d68600c8850aeed8fe2b3d464/raw/1ab91f4fd7b386bedb7958e8593fd894b523ebc7/docker-image-tools.sh
curl -L -o "${PWD}/_tools.sh" https://gist.github.com/Wolvverine/cd03f29d68600c8850aeed8fe2b3d464/raw
fi
# shellcheck disable=SC1090
source "${PWD}/_tools.sh"
Expand Down Expand Up @@ -140,4 +140,4 @@ if ! docker exec "${image_name}" test -d plugins/timezones; then
docker logs "${image_name}"
false
fi
stop_and_remove_container "${image_name}"
stop_and_remove_container "${image_name}"

0 comments on commit ed2e562

Please sign in to comment.