From 791f4c7e74ade938f079f66abf577c3258b8c54d Mon Sep 17 00:00:00 2001 From: Robin ALEXANDER <64310405+colisee@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:05:34 +0200 Subject: [PATCH] Issue 58 (#59) * Switch to install-php-extensions * Set image labels at the end of the Dockerfile * Copy the entrypoint program at the beginning * Install the ldap extension for php to fix issue 58 * Add plugins configuration files in volume /config --------- Co-authored-by: Robin Alexander --- Dockerfile | 27 ++++++++++++++------------- entrypoint.sh | 8 ++++++++ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index d4b68f9..7504011 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,17 @@ ARG PHP_VERSION FROM php:${PHP_VERSION}-apache +# Copy the entrypoint program +COPY entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/entrypoint.sh + # Install composer COPY --from=composer/composer:latest-bin /composer /usr/bin/composer +# Add command install-php-extensions +ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ +RUN chmod +x /usr/local/bin/install-php-extensions + # Customize ARG APP_GH_REF ENV DEBIAN_FRONTEND=noninteractive @@ -13,7 +21,6 @@ RUN set -ex; \ apt-get update; \ apt-get upgrade --yes; \ apt-get install --yes --no-install-recommends git unzip; \ - apt-get install --yes libpng-dev libjpeg-dev; \ apt-get clean; \ rm -rf /var/lib/apt/lists/* @@ -22,9 +29,7 @@ RUN set -ex; \ cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \ a2enmod rewrite; \ a2enmod headers; \ - docker-php-ext-configure gd --with-jpeg; \ - docker-php-ext-install -j$(nproc) gd; \ - docker-php-ext-install -j$(nproc) mysqli; \ + install-php-extensions mysqli gd ldap; \ pecl install timezonedb; \ docker-php-ext-enable timezonedb @@ -55,6 +60,11 @@ RUN set -ex; \ chown www-data:www-data /app.log; \ mkdir /config +# Declarations +VOLUME /config +ENTRYPOINT ["entrypoint.sh"] +CMD ["apache2-foreground"] + # Labels LABEL org.opencontainers.image.title="LibreBooking" LABEL org.opencontainers.image.description="LibreBooking as a container" @@ -62,12 +72,3 @@ LABEL org.opencontainers.image.url="https://github.com/librebooking/docker" LABEL org.opencontainers.image.source="https://github.com/librebooking/docker" LABEL org.opencontainers.image.licenses="GPL-3.0" LABEL org.opencontainers.image.authors="robin.alexander@netplus.ch" - -# Copy the entrypoint program -COPY entrypoint.sh /usr/local/bin/ -RUN chmod +x /usr/local/bin/entrypoint.sh - -# Declarations -VOLUME /config -ENTRYPOINT ["entrypoint.sh"] -CMD ["apache2-foreground"] diff --git a/entrypoint.sh b/entrypoint.sh index 4383f58..4129a4b 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -84,6 +84,14 @@ if ! [ -f /var/www/html/config/config.php ]; then ln -s /config/config.php /var/www/html/config/config.php fi +# Create the plugins configuration file inside the volume +for source in $(find /var/www/html/plugins -type f -name "*dist*"); do + target=$(echo "${source}" | sed -e "s/.dist//") + cp --no-clobber "${source}" "/config/$(basename ${target})" + chown www-data:www-data "/config/$(basename ${target})" + ln -s "/config/$(basename ${target})" "${target}" +done + # Set timezone if test -f /usr/share/zoneinfo/${TZ}; then ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime