Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktar Tairau committed Feb 4, 2022
0 parents commit c158657
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Dockerfile
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# php-swoole
16 changes: 16 additions & 0 deletions php.ini
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

0 comments on commit c158657

Please sign in to comment.