Dockerfile 2 KB
Newer Older
Dominik Hebeler's avatar
Dominik Hebeler committed
1
FROM alpine:3.9.5
Phil Höfer's avatar
Phil Höfer committed
2

Dominik Hebeler's avatar
Dominik Hebeler committed
3
4
5
RUN apk add --update \
    nginx \
    tzdata \
Dominik Hebeler's avatar
Dominik Hebeler committed
6
    ca-certificates \
Dominik Hebeler's avatar
Dominik Hebeler committed
7
    dcron \
Dominik Hebeler's avatar
Dominik Hebeler committed
8
    zip \
Dominik Hebeler's avatar
Dominik Hebeler committed
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
    redis \
    php7 \
    php7-fpm \
    php7-common \
    php7-curl \
    php7-mbstring \
    php7-sqlite3 \
    php7-pdo_mysql \
    php7-pdo_sqlite \
    php7-dom \
    php7-simplexml \
    php7-tokenizer \
    php7-zip \
    php7-redis \
    php7-gd \
    php7-json \
    php7-pcntl \
    && rm -rf /var/cache/apk/*
Dominik Hebeler's avatar
Dominik Hebeler committed
27

Dominik Hebeler's avatar
Dominik Hebeler committed
28
WORKDIR /html
Dominik Hebeler's avatar
Dominik Hebeler committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

RUN sed -i 's/user = nobody/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/group = nobody/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/pm.max_children = 5/pm.max_children = 100/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/pm.start_servers = 2/pm.start_servers = 5/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 25/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/user = www-data/user = nginx/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/group = www-data/group = nginx/g' /etc/php7/php-fpm.d/www.conf && \
    sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php7/php.ini && \
    echo "daemonize yes" >> /etc/redis.conf && \
    ln -s /dev/null /var/log/nginx/access.log && \
    ln -s /dev/stdout /var/log/nginx/error.log && \
    cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
    echo "Europe/Berlin" > /etc/timezone && \
    (crontab -l ; echo "* * * * * php /html/artisan schedule:run >> /dev/null 2>&1") | crontab -
Phil Höfer's avatar
Phil Höfer committed
45

Dominik Hebeler's avatar
Dominik Hebeler committed
46
47
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
48
COPY --chown=root:nginx . /html
Phil Höfer's avatar
Phil Höfer committed
49

Dominik Hebeler's avatar
Dominik Hebeler committed
50
51
52
WORKDIR /html
EXPOSE 80

53
54
CMD chown -R root:nginx storage/logs/metager bootstrap/cache && \
    chmod -R g+w storage/logs/metager bootstrap/cache && \
Dominik Hebeler's avatar
Dominik Hebeler committed
55
56
57
58
59
    crond -L /dev/stdout && \
    nginx && \
    php-fpm7 -D && \
    redis-server /etc/redis.conf && \
    su -s /bin/sh -c 'php artisan requests:fetcher' nginx