Skip to content

Commit 4aa5e18

Browse files
authored
Prepare for container version-3 (#130)
### Changes - container runs with non-root user `www-data` - if cron is needed, then a second container instance should be launched with: - user: `root` - entrypoint: `/usr/local/bin/cron.sh`
1 parent 3fb3a58 commit 4aa5e18

5 files changed

Lines changed: 234 additions & 129 deletions

File tree

Dockerfile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ LABEL org.opencontainers.image.source="https://github.com/librebooking/docker"
1212
LABEL org.opencontainers.image.licenses="GPL-3.0"
1313
LABEL org.opencontainers.image.authors="colisee@hotmail.com"
1414

15-
# Copy entrypoint
16-
COPY --chmod=755 entrypoint.sh /usr/local/bin/
15+
# Copy entrypoint scripts
16+
COPY --chmod=755 bin /usr/local/bin/
1717

1818
# Create cron jobs
19-
COPY --chown=www-data:www-data lb-jobs-cron /root/
19+
COPY --chown=www-data:www-data lb-jobs-cron /config/
2020

2121
# Copy composer
2222
COPY --from=comp /usr/bin/composer /usr/bin/composer
@@ -39,6 +39,7 @@ RUN set -ex; \
3939

4040
# Customize
4141
RUN set -ex; \
42+
chown www-data:www-data /config;\
4243
cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
4344
{ \
4445
echo 'RemoteIPHeader X-Real-IP'; \
@@ -53,7 +54,11 @@ RUN set -ex; \
5354
docker-php-ext-configure gd --with-jpeg --with-freetype; \
5455
docker-php-ext-install mysqli gd ldap; \
5556
pecl install timezonedb; \
56-
docker-php-ext-enable timezonedb
57+
docker-php-ext-enable timezonedb; \
58+
mkdir --parent /var/log/librebooking; \
59+
chown www-data:www-data /var/log/librebooking; \
60+
touch /usr/local/etc/php/conf.d/librebooking.ini; \
61+
chown www-data:www-data /usr/local/etc/php/conf.d/librebooking.ini
5762

5863
# Get and customize librebooking
5964
USER www-data
@@ -80,7 +85,6 @@ RUN set -ex; \
8085
fi
8186

8287
# Environment
83-
USER root
8488
WORKDIR /
8589
VOLUME /config
8690
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

0 commit comments

Comments
 (0)