-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_alpine
162 lines (154 loc) · 5.84 KB
/
Dockerfile_alpine
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
FROM alpine:3.21.0
LABEL maintainer="DI GREGORIO Nicolas <[email protected]>"
ARG PHP_VERSION='83'
ARG PHPUNIT_VERSION='11'
### Environment variables
ENV LANG='en_US.UTF-8' \
LANGUAGE='en_US.UTF-8' \
TERM='xterm' \
APPUSER='php-fpm' \
APPGID='10001' \
APPUID='10001' \
PHP_VERSION="${PHP_VERSION}" \
PHPUNIT_VERSION="${PHPUNIT_VERSION}" \
SCL_REPO='' \
SCL_PREFIX='' \
SCL_PKG_PREFIX='' \
SCL_PKG_PREFIX2='' \
ORACLE_CLIENT_VERSION=''
ENV PHP_CONF_PREFIX="/etc/"
ENV PHP_FPM_CONF="${PHP_CONF_PREFIX}php${PHP_VERSION}/php-fpm.conf" \
PHP_FPM_POOL_CONF="${PHP_CONF_PREFIX}php${PHP_VERSION}/php-fpm.d/www.conf" \
PHP_INI="${PHP_CONF_PREFIX}php${PHP_VERSION}/php.ini" \
PHP_APCU_CONF="${PHP_CONF_PREFIX}php${PHP_VERSION}/conf.d/apcu.ini" \
PHP_FPM_LOGFILE="/var/log/php${PHP_VERSION}/www-error.log"
# Copy config files
COPY root/ /
### Install Application
RUN set -x && \
chmod 1777 /tmp && \
. /usr/local/bin/docker-entrypoint-functions.sh && \
MYUSER="${APPUSER}" && \
MYUID="${APPUID}" && \
MYGID="${APPGID}" && \
ConfigureUser && \
apk update --no-cache && \
apk add --no-cache --virtual=run-deps \
bash \
ffmpeg \
icu-data-full \
imagemagick-svg \
imagemagick-heic \
libheif \
php${PHP_VERSION}-fpm \
php${PHP_VERSION}-cli \
php${PHP_VERSION}-bcmath \
php${PHP_VERSION}-exif \
php${PHP_VERSION}-gd \
php${PHP_VERSION}-gmp \
php${PHP_VERSION}-intl \
php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-mysqli \
php${PHP_VERSION}-odbc \
php${PHP_VERSION}-opcache \
php${PHP_VERSION}-pdo \
php${PHP_VERSION}-pgsql \
php${PHP_VERSION}-soap \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-zip \
php${PHP_VERSION}-pecl-apcu \
php${PHP_VERSION}-pecl-imagick \
php${PHP_VERSION}-pecl-memcache \
php${PHP_VERSION}-pecl-redis \
php${PHP_VERSION}-bz2 \
php${PHP_VERSION}-ctype \
php${PHP_VERSION}-curl \
php${PHP_VERSION}-dom \
php${PHP_VERSION}-fileinfo \
php${PHP_VERSION}-ftp \
php${PHP_VERSION}-gettext \
php${PHP_VERSION}-iconv \
php${PHP_VERSION}-json \
php${PHP_VERSION}-openssl \
php${PHP_VERSION}-pcntl \
php${PHP_VERSION}-pdo_dblib \
php${PHP_VERSION}-pdo_odbc \
php${PHP_VERSION}-pdo_mysql \
php${PHP_VERSION}-pdo_pgsql \
php${PHP_VERSION}-pdo_sqlite \
php${PHP_VERSION}-phar \
php${PHP_VERSION}-posix \
php${PHP_VERSION}-simplexml \
php${PHP_VERSION}-sodium \
php${PHP_VERSION}-sqlite3 \
php${PHP_VERSION}-sysvsem \
php${PHP_VERSION}-tokenizer \
php${PHP_VERSION}-xmlreader \
php${PHP_VERSION}-xmlwriter \
ssmtp \
su-exec \
&& \
echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories && \
cat /etc/apk/repositories && \
apk update --no-cache && \
apk add --no-cache --virtual=run-deps-testing \
php${PHP_VERSION}-pecl-mcrypt \
&& \
php${PHP_VERSION} -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php${PHP_VERSION} composer-setup.php --install-dir=/usr/local/bin --filename=composer && \
php${PHP_VERSION} -r "unlink('composer-setup.php');" && \
php${PHP_VERSION} -r "copy('https://phar.phpunit.de/phpunit-${PHPUNIT_VERSION}.phar', 'phpunit');" && \
chmod +x phpunit && \
mv phpunit /usr/local/bin/ && \
sed -i \
-e "s|upload_max_filesize\s*=.*|upload_max_filesize = 100M|g" \
-e "s|max_file_uploads\s*=.*|max_file_uploads = 50|g" \
-e "s|post_max_size\s*=.*|post_max_size = 100M|g" \
-e "s|;cgi.fix_pathinfo\s*=.*|cgi.fix_pathinfo = 1|g" \
-e "s|;date.timezone\s*=.*|date.timezone = Europe/Paris|g" \
-e "s|memory_limit\s*=.*|memory_limit = 2048M|g" \
-e "s|;opcache.interned_strings_buffer\s*=.*|opcache.interned_strings_buffer=32|g"\
${PHP_INI} && \
sed -i \
-e "s|;*daemonize\s*=\s*yes|daemonize = no|g" \
${PHP_FPM_CONF} && \
sed -i \
-e "s|user\s*=.*|user = php-fpm|g" \
-e "s|group\s*=.*|group = php-fpm|g" \
-e "s|listen\s*=.*|listen = 0.0.0.0:9000|g" \
-e "s|listen.allowed_clients\s*=.*|;listen.allowed_clients = 127.0.0.1|g" \
-e "s|pm.max_children\s*=.*|pm.max_children = 20|g" \
-e "s|pm.start_servers\s*=.*|pm.start_servers = 2|g" \
-e "s|pm.min_spare_servers\s*=.*|pm.min_spare_servers = 1|g" \
-e "s|pm.max_spare_servers\s*=.*|pm.max_spare_servers = 3|g" \
-e "s|;catch_workers_output\s*=.*|catch_workers_output = yes|g" \
-e "s|;clear_env\s*=.*|clear_env = no|g" \
${PHP_FPM_POOL_CONF} && \
echo "env[NSS_SDB_USE_CACHE] = YES" >> ${PHP_FPM_POOL_CONF} && \
echo "env[TNS_ADMIN] = /usr/lib/oracle/${ORACLE_CLIENT_VERSION}/client64/network/admin" >> ${PHP_FPM_POOL_CONF} && \
echo "env[NLS_LANG] = FRENCH_FRANCE.AL32UTF8" >> ${PHP_FPM_POOL_CONF} && \
sed -i \
-e "s|apc.enabled\s*=.*|apc.enabled=1|g" \
-e "s|[;|]apc.shm_size\s*=.*|apc.shm_size=512M|g" \
-e "s|[;|]apc.enable_cli\s*=.*|apc.enable_cli=1|g" \
${PHP_APCU_CONF} && \
rm -rf ${PHP_FPM_LOGFILE} && \
ln -snf /proc/self/fd/2 ${PHP_FPM_LOGFILE} && \
ln -snf /usr/sbin/php-fpm${PHP_VERSION} /usr/local/bin/php-fpm && \
ln -snf /usr/bin/php${PHP_VERSION} /usr/local/bin/php && \
mkdir -p /var/www/html/default && \
mkdir -p /docker-entrypoint.d && \
chmod +x /usr/local/bin/docker-entrypoint.sh && \
ln -snf /usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh && \
rm -rf /tmp/* \
/var/cache/apk/* \
/var/tmp/*
# Expose volumes
#VOLUME ["/var/www/html/default"]
# Expose ports
EXPOSE 9000
### Running User: not used, managed by docker-entrypoint.sh
#USER wwwuser
### Start php-fpm
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["php-fpm"]