Dockerfile 1.87 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
FROM nginx
Phil Höfer's avatar
Phil Höfer committed
2

Dominik Hebeler's avatar
Dominik Hebeler committed
3
4
RUN apt -y update && apt -y install php-fpm \
    ca-certificates \
Dominik Hebeler's avatar
Dominik Hebeler committed
5
    cron \
Dominik Hebeler's avatar
Dominik Hebeler committed
6
7
8
9
10
    zip \
    php7.3-common \
    php7.3-curl \
    php7.3-mbstring \
    php7.3-sqlite3 \
Dominik Hebeler's avatar
Dominik Hebeler committed
11
    php7.3-mysql \
Dominik Hebeler's avatar
Dominik Hebeler committed
12
13
14
15
16
    php7.3-xml \
    php7.3-zip \
    php7.3-redis \
    php7.3-gd \
    redis-server
Phil Höfer's avatar
Phil Höfer committed
17

Dominik Hebeler's avatar
Dominik Hebeler committed
18
19
RUN sed -i 's/listen.owner = www-data/listen.owner = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \
    sed -i 's/listen.group = www-data/listen.group = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \
Dominik Hebeler's avatar
Dominik Hebeler committed
20
21
22
    sed -i 's/pm.max_children = 5/pm.max_children = 100/g' /etc/php/7.3/fpm/pool.d/www.conf && \
    sed -i 's/pm.start_servers = 2/pm.start_servers = 25/g' /etc/php/7.3/fpm/pool.d/www.conf && \
    sed -i 's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g' /etc/php/7.3/fpm/pool.d/www.conf && \
Dominik Hebeler's avatar
Dominik Hebeler committed
23
    sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 25/g' /etc/php/7.3/fpm/pool.d/www.conf && \
Dominik Hebeler's avatar
Dominik Hebeler committed
24
25
26
27
    sed -i 's/user = www-data/user = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \
    sed -i 's/group = www-data/group = nginx/g' /etc/php/7.3/fpm/pool.d/www.conf && \
    sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/7.3/fpm/php.ini && \
    mkdir /html
Phil Höfer's avatar
Phil Höfer committed
28

29
30
31
# Set correct timezone
RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

Dominik Hebeler's avatar
Dominik Hebeler committed
32
33
34
# Add Cronjob for Laravel
RUN (crontab -l ; echo "* * * * * php /html/artisan schedule:run >> /dev/null 2>&1") | crontab

Dominik Hebeler's avatar
Dominik Hebeler committed
35
36
WORKDIR /html
EXPOSE 80
Phil Höfer's avatar
Phil Höfer committed
37

Dominik Hebeler's avatar
Dominik Hebeler committed
38
39
COPY config/nginx.conf /etc/nginx/nginx.conf
COPY config/nginx-default.conf /etc/nginx/conf.d/default.conf
Dominik Hebeler's avatar
Dominik Hebeler committed
40
COPY --chown=root:nginx . /html
Phil Höfer's avatar
Phil Höfer committed
41

42
43
44
CMD chown -R root:nginx storage/logs/metager bootstrap/cache && \
    chmod -R g+w storage/logs/metager bootstrap/cache && \
    /etc/init.d/cron start && \
45
46
47
    /etc/init.d/php7.3-fpm start && \
    /etc/init.d/nginx start && \
    /etc/init.d/redis-server start && \
Dominik Hebeler's avatar
Dominik Hebeler committed
48
    su -s /bin/bash -c 'php artisan requests:fetcher' nginx