-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Viktar Tairau
committed
Feb 4, 2022
0 parents
commit c158657
Showing
3 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
FROM php:8.1.2-alpine as runtime | ||
|
||
ARG UID=1000 | ||
ARG GID=1000 | ||
|
||
ENV COMPOSER_HOME="/tmp/composer" | ||
ENV PHPREDIS_VERSION="5.3.6" | ||
ENV SWOOLE_VERSION="v4.10.0" | ||
|
||
RUN set -x \ | ||
&& apk add --no-cache \ | ||
postgresql-libs \ | ||
npm \ | ||
&& apk add --no-cache --virtual .build-deps \ | ||
postgresql-dev \ | ||
autoconf \ | ||
openssl \ | ||
curl-dev \ | ||
make \ | ||
g++ \ | ||
# install phpredis extension \ | ||
&& docker-php-source extract \ | ||
&& mkdir -p /usr/src/php/ext/redis \ | ||
&& curl -L https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/redis/ --strip 1 \ | ||
&& mkdir -p /usr/src/php/ext/swoole \ | ||
&& curl -L https://github.com/openswoole/swoole-src/archive/$SWOOLE_VERSION.tar.gz | tar xvz -C /usr/src/php/ext/swoole --strip 1 \ | ||
&& docker-php-ext-configure swoole --enable-swoole-curl \ | ||
&& CFLAGS="$CFLAGS -D_GNU_SOURCE" docker-php-ext-install -j$(nproc) \ | ||
pdo_pgsql \ | ||
sockets \ | ||
redis \ | ||
swoole \ | ||
opcache \ | ||
pcntl \ | ||
intl \ | ||
exif \ | ||
1>/dev/null \ | ||
# make clean up | ||
&& docker-php-source delete \ | ||
&& apk del .build-deps | ||
|
||
COPY --from=composer:2.2.5 /usr/bin/composer /usr/bin/composer | ||
|
||
COPY php.ini /usr/local/etc/php/conf.d/ | ||
|
||
RUN addgroup -S php -g $GID \ | ||
&& adduser -u $UID -S -G php php \ | ||
&& mkdir /app \ | ||
&& chown php:php /app | ||
|
||
# use an unprivileged user by default | ||
USER php:php | ||
|
||
# use directory with application sources by default | ||
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# php-swoole |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
memory_limit=-1 | ||
upload_max_filesize=64M | ||
post_max_size=64M | ||
|
||
[opcache] | ||
opcache.enable=1 | ||
opcache.enable_cli=1 | ||
opcache.jit_buffer_size=32M | ||
opcache.jit=1235 | ||
opcache.revalidate_freq=0 | ||
opcache.validate_timestamps=${OPCACHE_VALIDATE_TIMESTAMPS} | ||
opcache.max_accelerated_files=20000 | ||
opcache.memory_consumption=256 | ||
opcache.max_wasted_percentage=10 | ||
opcache.interned_strings_buffer=16 | ||
opcache.fast_shutdown=1 |