@@ -23,123 +23,16 @@ COPY --from=comp /usr/bin/composer /usr/bin/composer
2323
2424# Update and install required debian packages
2525ENV DEBIAN_FRONTEND=noninteractive
26- SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
27- # hadolint ignore=DL3008 # 'Pin versions in apt get install'
28- RUN <<EORUN
29- set -xeu
30- apt-get update
31- apt-get upgrade --yes
32- apt-get install --yes --no-install-recommends \
33- cron \
34- git \
35- libjpeg-dev \
36- libldap-dev \
37- libpng-dev \
38- libfreetype6-dev \
39- unzip
40- apt-get clean
41- rm -rf /var/lib/apt/lists/*
42- EORUN
43-
44- # Customize the http & php environment
45- RUN <<EORUN
46- set -xeu
47- cp "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
48- cat > /etc/apache2/conf-available/remoteip.conf <<EOF
49- RemoteIPHeader X-Real-IP
50- RemoteIPInternalProxy 10.0.0.0/8
51- RemoteIPInternalProxy 172.16.0.0/12
52- RemoteIPInternalProxy 192.168.0.0/16
53- EOF
54- a2enconf remoteip
55- a2enmod rewrite
56- a2enmod headers
57- a2enmod remoteip
58- docker-php-ext-configure gd --with-jpeg --with-freetype
59- docker-php-ext-install mysqli gd ldap
60- pecl install timezonedb
61- docker-php-ext-enable timezonedb
62- mkdir --parent /var/log/librebooking
63- chown --recursive www-data:root /var/log/librebooking
64- chmod --recursive g+rwx /var/log/librebooking
65- touch /usr/local/etc/php/conf.d/librebooking.ini
66- sed \
67- -i /etc/apache2/ports.conf \
68- -e 's/Listen 80/Listen 8080/' \
69- -e 's/Listen 443/Listen 8443/'
70- sed \
71- -i /etc/apache2/sites-available/000-default.conf \
72- -e 's/<VirtualHost *:80>/<VirtualHost *:8080>/'
73- EORUN
74-
75- # Get and customize librebooking
7626ARG APP_GH_REF
7727ARG APP_GH_ADD_SHA=false
28+ # hadolint ignore=DL3008 # 'Pin versions in apt get install'
29+ COPY setup.sh /usr/local/bin/setup.sh
7830RUN <<EORUN
7931set -xeu
80- LB_TARBALL_URL="https://api.github.com/repos/LibreBooking/librebooking/tarball/${APP_GH_REF}"
81- curl \
82- --fail \
83- --silent \
84- --location ${LB_TARBALL_URL} \
85- | tar --extract --gzip --directory=/var/www/html --strip-components=1
86- if [ "${APP_GH_ADD_SHA}" = "true" ]; then
87- LB_SHORT_SHA=""
88- # TARBALL_FILENAME will be like the result of a `git describe` For
89- # example: 'LibreBooking-librebooking-v4.1.0-126-g6cc8a4c.tar.gz' where
90- # 'g6cc8a4c' is the short SHA prefixed with 'g'. So the short SHA is
91- # '6cc8a4c'
92- TARBALL_FILENAME=$(\
93- curl \
94- --head \
95- --fail \
96- --silent \
97- --show-error \
98- --location ${LB_TARBALL_URL} \
99- | sed -nE 's/.*filename="?([^";]+)"?.*/\1 /p' )
100- LB_SHORT_SHA=$(echo "${TARBALL_FILENAME}" | sed -E 's/.*-g([0-9a-f]+)\. tar\. gz/\1 /' )
101- if [ -n "${LB_SHORT_SHA}" ]; then
102- printf '%s\n ' "${LB_SHORT_SHA}" > /var/www/html/config/version-suffix.txt
103- else
104- echo "ERROR determining the LB_SHORT_SHA value from TARBALL_FILENAME ${TARBALL_FILENAME}" >&2
105- exit 1
106- fi
107- fi
108- if [ -f /var/www/html/composer.json ]; then
109- sed \
110- -i /var/www/html/composer.json \
111- -e "s:\( .*\) nickdnk/graph-sdk\( .*\) 7.0\( .*\) :\1 joelbutcher/facebook-graph-sdk\2 6.1\3 :"
112- composer install
113- fi
114- sed \
115- -i /var/www/html/database_schema/create-user.sql \
116- -e "s:^DROP USER ':DROP USER IF EXISTS ':g" \
117- -e "s:booked_user:schedule_user:g" \
118- -e "s:localhost:%:g"
119- if ! [ -d /var/www/html/tpl_c ]; then
120- mkdir /var/www/html/tpl_c
121- fi
122- mkdir /var/www/html/Web/uploads/reservation
123- EORUN
124-
125- RUN <<EORUN
126- set -xeu
127- chown www-data:root \
128- /var/www/html/config \
129- /var/www/html/tpl_c \
130- /var/www/html/Web/uploads/images \
131- /var/www/html/Web/uploads/reservation \
132- /usr/local/etc/php/conf.d/librebooking.ini
133- chmod g+rwx \
134- /var/www/html/config \
135- /var/www/html/tpl_c \
136- /var/www/html/Web/uploads/images \
137- /var/www/html/Web/uploads/reservation \
138- /usr/local/etc/php/conf.d/librebooking.ini
139- chown --recursive www-data:root \
140- /var/www/html/plugins
141- chmod --recursive g+rwx \
142- /var/www/html/plugins
32+ export APP_GH_REF=${APP_GH_REF}
33+ export APP_GH_ADD_SHA=${APP_GH_ADD_SHA}
34+ chmod +x /usr/local/bin/setup.sh
35+ /usr/local/bin/setup.sh
14336EORUN
14437
14538# Environment
0 commit comments