Skip to content

Commit 791f4c7

Browse files
coliseeRobin Alexander
andauthored
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 <robin.alexander@netplus.ch>
1 parent e1a3922 commit 791f4c7

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

Dockerfile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
ARG PHP_VERSION
22
FROM php:${PHP_VERSION}-apache
33

4+
# Copy the entrypoint program
5+
COPY entrypoint.sh /usr/local/bin/
6+
RUN chmod +x /usr/local/bin/entrypoint.sh
7+
48
# Install composer
59
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
610

11+
# Add command install-php-extensions
12+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
13+
RUN chmod +x /usr/local/bin/install-php-extensions
14+
715
# Customize
816
ARG APP_GH_REF
917
ENV DEBIAN_FRONTEND=noninteractive
@@ -13,7 +21,6 @@ RUN set -ex; \
1321
apt-get update; \
1422
apt-get upgrade --yes; \
1523
apt-get install --yes --no-install-recommends git unzip; \
16-
apt-get install --yes libpng-dev libjpeg-dev; \
1724
apt-get clean; \
1825
rm -rf /var/lib/apt/lists/*
1926

@@ -22,9 +29,7 @@ RUN set -ex; \
2229
cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
2330
a2enmod rewrite; \
2431
a2enmod headers; \
25-
docker-php-ext-configure gd --with-jpeg; \
26-
docker-php-ext-install -j$(nproc) gd; \
27-
docker-php-ext-install -j$(nproc) mysqli; \
32+
install-php-extensions mysqli gd ldap; \
2833
pecl install timezonedb; \
2934
docker-php-ext-enable timezonedb
3035

@@ -55,19 +60,15 @@ RUN set -ex; \
5560
chown www-data:www-data /app.log; \
5661
mkdir /config
5762

63+
# Declarations
64+
VOLUME /config
65+
ENTRYPOINT ["entrypoint.sh"]
66+
CMD ["apache2-foreground"]
67+
5868
# Labels
5969
LABEL org.opencontainers.image.title="LibreBooking"
6070
LABEL org.opencontainers.image.description="LibreBooking as a container"
6171
LABEL org.opencontainers.image.url="https://github.com/librebooking/docker"
6272
LABEL org.opencontainers.image.source="https://github.com/librebooking/docker"
6373
LABEL org.opencontainers.image.licenses="GPL-3.0"
6474
LABEL org.opencontainers.image.authors="robin.alexander@netplus.ch"
65-
66-
# Copy the entrypoint program
67-
COPY entrypoint.sh /usr/local/bin/
68-
RUN chmod +x /usr/local/bin/entrypoint.sh
69-
70-
# Declarations
71-
VOLUME /config
72-
ENTRYPOINT ["entrypoint.sh"]
73-
CMD ["apache2-foreground"]

entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ if ! [ -f /var/www/html/config/config.php ]; then
8484
ln -s /config/config.php /var/www/html/config/config.php
8585
fi
8686

87+
# Create the plugins configuration file inside the volume
88+
for source in $(find /var/www/html/plugins -type f -name "*dist*"); do
89+
target=$(echo "${source}" | sed -e "s/.dist//")
90+
cp --no-clobber "${source}" "/config/$(basename ${target})"
91+
chown www-data:www-data "/config/$(basename ${target})"
92+
ln -s "/config/$(basename ${target})" "${target}"
93+
done
94+
8795
# Set timezone
8896
if test -f /usr/share/zoneinfo/${TZ}; then
8997
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime

0 commit comments

Comments
 (0)