forked from lbryio/block-explorer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
68 lines (49 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
68 lines (49 loc) · 1.82 KB
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
FROM php:8.4.7-fpm-alpine
# Install PHPize packages
RUN apk add --no-cache --virtual .phpize $PHPIZE_DEPS
# Install Source Packages
ENV SRC_DEPS="gmp-dev icu-dev"
RUN apk add --no-cache --virtual .source $SRC_DEPS
# Install Binary Packages
ENV BIN_DEPS="gmp git icu nginx"
RUN apk add --no-cache --virtual .binary $BIN_DEPS
# Install PHP Extensions
RUN pecl install redis
RUN docker-php-ext-enable redis
RUN docker-php-ext-install bcmath
RUN docker-php-ext-install gmp
RUN docker-php-ext-install mysqli
RUN docker-php-ext-install opcache
RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
# Delete PHPize packages
RUN apk del --no-network --no-cache --purge .phpize
# Delete Source packages
RUN apk del --no-network --no-cache --purge .source
# Remove files
RUN rm -rf /tmp/pear
RUN rm -rf ~/.pearrc
RUN rm -rf /var/cache/apk/*
# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Copy files
WORKDIR /var/www/html
COPY . .
RUN mv nginx.conf /etc/nginx/http.d/default.conf
# Redirect NGINX logs
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
# Install project using Composer
RUN --mount=type=cache,target=/root/.composer composer install --no-interaction --optimize-autoloader --no-dev
# Change permissions
RUN chown -R www-data:www-data storage/
# Setup Process Manager
RUN echo "pm = ondemand" >> /usr/local/etc/php-fpm.d/zz-docker.conf
RUN echo "pm.process_idle_timeout = 10s" >> /usr/local/etc/php-fpm.d/zz-docker.conf
# Setup PHP
RUN mv php.ini /usr/local/etc/php/conf.d/
# Setup Opcache
RUN mv opcache.ini /usr/local/etc/php/conf.d/
VOLUME /var/www/html/storage/framework/cache/data
# Cache project and Start PHP-FPM and NGINX
CMD php artisan optimize; php artisan event:cache; php artisan view:cache; php-fpm -D; nginx -g "daemon off;"