-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·84 lines (71 loc) · 2.07 KB
/
Dockerfile
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
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM php:8.3-fpm-alpine3.19 AS rte
# Install Caddy
RUN apk add --no-cache \
curl \
libcap \
mailcap \
&& apk add caddy
# install php extensions
RUN apk add --no-cache \
icu-dev \
postgresql-dev \
libzip-dev \
$PHPIZE_DEPS \
&& pecl install \
redis \
apcu \
&& docker-php-ext-install \
intl \
opcache \
pdo_mysql \
pdo_pgsql \
zip \
&& docker-php-ext-enable \
redis \
sodium \
apcu
# install composer
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer
# configure caddy
COPY ./etc/Caddyfile /etc/caddy/Caddyfile
RUN mkdir -p /var/www/.config/caddy \
&& chmod -R 777 /var/www/.config
ENV CADDY_CGI_SERVER_HOST="127.0.0.1"
ENV CADDY_CGI_SERVER_PORT="9000"
ENV CADDY_LOG_OUTPUT="stderr"
# DEBUG|INFO|WARN|ERROR|PANIC|FATAL (https://caddyserver.com/docs/json/logging/logs/level/)
ENV CADDY_LOG_LEVEL="ERROR"
# FPM configuration
COPY ./etc/php-fpm.conf /usr/local/etc/php-fpm.d/php-fpm.conf
ENV FPM_WORKERS_COUNT="2"
# "/proc/self/fd/1" does not work for FPM_ACCESS_LOG
ENV FPM_ACCESS_LOG="/proc/self/fd/2"
ENV FPM_ERROR_LOG="/proc/self/fd/2"
# debug|notice|warning|error|alert (https://www.php.net/manual/en/install.fpm.configuration.php#log-level)
ENV FPM_LOG_LEVEL="error"
# configure php
COPY ./etc/php.ini /usr/local/etc/php/conf.d/php.ini
ENV PHP_OPCACHE_ENABLE="true"
COPY ./etc/apcu.ini /usr/local/etc/php/conf.d/apcu.ini
ENV PHP_APCU_ENABLE=1
ENV PHP_ERROR_LOG="/proc/self/fd/2"
# E_ALL|E_STRICT|E_NOTICE|E_WARNING|E_ERROR|E_CORE_ERROR (https://www.php.net/manual/en/errorfunc.constants.php)
ENV PHP_LOG_LEVEL="E_ERROR"
# configure composer
ENV COMPOSER_ALLOW_SUPERUSER="1"
# entrypoint
ENTRYPOINT []
CMD ["sh", "-c", "php-fpm --daemonize && caddy run --config=/etc/caddy/Caddyfile"]
EXPOSE 80 9000
HEALTHCHECK NONE
WORKDIR /app
FROM rte AS sdk
# install xdebug
RUN apk add --no-cache $PHPIZE_DEPS linux-headers \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug
# configure xdebug
COPY ./etc/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
ENV XDEBUG_MODE="off"
ENV XDEBUG_CONFIG=""
ENV XDEBUG_OUTPUT_DIR="/tmp"