-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
82 lines (73 loc) · 2.56 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ARG PHP_VERSION
FROM php:${PHP_VERSION}-apache
# Install composer
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer
# Customize
ARG APP_GH_REF
ENV DEBIAN_FRONTEND=noninteractive
# Update and install required debian packages
RUN set -ex; \
apt-get update; \
apt-get upgrade --yes; \
apt-get install --yes --no-install-recommends git unzip; \
apt-get install --yes --no-install-recommends libpng-dev libjpeg-dev; \
apt-get install --yes --no-install-recommends libldap-dev; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Customize apache and php settings
RUN set -ex; \
cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"; \
{ \
echo 'RemoteIPHeader X-Real-IP'; \
echo 'RemoteIPInternalProxy 10.0.0.0/8'; \
echo 'RemoteIPInternalProxy 172.16.0.0/12'; \
echo 'RemoteIPInternalProxy 192.168.0.0/16'; \
} > /etc/apache2/conf-available/remoteip.conf; \
a2enconf remoteip; \
a2enmod rewrite; \
a2enmod headers; \
a2enmod remoteip; \
docker-php-ext-configure gd --with-jpeg; \
docker-php-ext-install mysqli gd ldap; \
pecl install timezonedb; \
docker-php-ext-enable timezonedb;
# Get and customize librebooking
USER www-data
RUN set -ex; \
curl \
--fail \
--silent \
--location https://api.github.com/repos/librebooking/app/tarball/${APP_GH_REF} \
| tar --extract --gzip --directory=/var/www/html --strip-components=1; \
if [ -f /var/www/html/composer.json ]; then \
composer install --ignore-platform-req=ext-gd; \
fi; \
sed \
-i /var/www/html/database_schema/create-user.sql \
-e "s:^DROP USER ':DROP USER IF EXISTS ':g" \
-e "s:booked_user:schedule_user:g" \
-e "s:localhost:%:g"; \
if ! [ -d /var/www/html/tpl_c ]; then \
mkdir /var/www/html/tpl_c; \
fi
# Final customization
USER root
RUN set -ex; \
touch /app.log; \
chown www-data:www-data /app.log; \
mkdir /config
# Environment
WORKDIR /
VOLUME /config
ENTRYPOINT ["/usr/local/bin/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="robin.alexander@netplus.ch"
# Set entrypoint
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh