-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.fpm
71 lines (62 loc) · 2.1 KB
/
Dockerfile.fpm
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
FROM php:8.3-fpm
RUN \
# system packages
apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
git \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/* \
\
# php extensions
&& docker-php-ext-install pdo_mysql gd \
\
# set up composer
&& EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") \
&& if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then \
>&2 echo 'ERROR: Invalid installer signature'; \
rm composer-setup.php; \
exit 1; \
fi \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet \
&& rm composer-setup.php \
\
# billett
&& mkdir -p /var/billett/cache \
&& mkdir -p /var/billett/logs \
&& mkdir -p /var/billett/meta \
&& mkdir -p /var/billett/sessions \
&& mkdir -p /var/billett/views \
&& chown -R www-data:www-data /var/billett /var/www /var/www/html
COPY --chown=www-data:www-data backend/composer.* /var/www/html/
USER www-data
# create directories that are scanned on composer install
# this is later replaced with new source, but we need this
# here to have cache of composer modules to avoid cache miss
# in case only our code is updated and not dependencies
RUN set -eux; \
mkdir -p \
app/Console/Commands \
app/Helpers \
database \
tests \
; \
echo -e '#!/usr/bin/env php\n<?php' >artisan; \
echo -e '#!/usr/bin/env php\n<?php' >tests/TestCase.php; \
echo -e '#!/usr/bin/env php\n<?php' >app/Helpers/format.php; \
composer install; \
mv vendor /var/www/html-vendor; \
ln -s /var/www/html-vendor /var/www/html/vendor
COPY --chown=www-data:www-data backend /var/www/html/
# we run composer install again so the post process commands
# are run
RUN composer install
USER root
VOLUME ["/var/billett"]
CMD ["php-fpm"]