Skip to content

Commit

Permalink
Issue 58 (#59)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
colisee and Robin Alexander authored Sep 22, 2023
1 parent e1a3922 commit 791f4c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/*

Expand All @@ -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

Expand Down Expand Up @@ -55,19 +60,15 @@ 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"
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="[email protected]"

# 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"]
8 changes: 8 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 791f4c7

Please sign in to comment.