Giter Site home page Giter Site logo

swoole / docker-swoole Goto Github PK

View Code? Open in Web Editor NEW
511.0 511.0 113.0 1.38 MB

🏄 Official Docker Image of Swoole

Home Page: https://hub.docker.com/r/phpswoole/swoole

License: Apache License 2.0

Shell 14.05% PHP 1.94% Dockerfile 83.43% Twig 0.58%
docker swoole

docker-swoole's Introduction

Docker Image for Swoole

Twitter Discord Docker Pulls License

This image is built for general-purpose. We have different examples included in this Git repository to help developers to get familiar with the image and Swoole.

You can get the image from here.

Table of Contents

Feature List

  • Built-in scripts to manage Swoole extensions and Supervisord programs.
  • Easy to manage booting scripts in Docker.
  • Allow running PHP scripts and other commands directly in different environments (including ECS).
  • Use one root filesystem for simplicity (one Docker COPY command only in dockerfiles).
  • Composer included (Composer v1 for Swoole 4.5.8 and before; Composer v2 for Swoole 4.5.9 and after).
  • Built for different architectures.
  • Support auto-reloading for local development.1
  • Support code debugging for local development.
  • PHP extension pdo_mysql included since 4.8.12+ and 5.0.1+.2
  • PHP extension Redis included since 4.8.12+ and 5.0.1+.2 It's installed with default options.

NOTES

  1. The auto-reloading feature is supported for non-Alpine images only.
  2. To disable extension pdo_mysql and/or Redis, please check section Disable Installed/Enabled PHP Extensions.

How to Use This Image

The phpswoole/swoole image is built using the official PHP image as base image, with a few changes. For basic usage, please check the description section of the official PHP image.

How to Install More PHP Extensions

Same as in the official PHP image, most PHP extensions can be installed/configured using built-in helper scripts docker-php-ext-configure, docker-php-ext-install, docker-php-ext-enable, and docker-php-source. Here are some examples.

# To install the MySQL extensions.
# NOTE: The pdo_mysql extension is included in 4.8.12+ and 5.0.1+ images.
FROM phpswoole/swoole:4.7-php7.4-alpine

RUN docker-php-ext-install mysqli pdo_mysql
# To install the Redis extension.
# NOTE: The Redis extension is included in 4.8.12+ and 5.0.1+ images.
FROM phpswoole/swoole:4.7-php7.4-alpine

RUN set -ex \
    && pecl channel-update pecl.php.net \
    && yes no | pecl install redis-stable \
    && docker-php-ext-enable redis
# To install the Couchbase extension.
FROM phpswoole/swoole:4.8-php7.4-alpine

RUN set -ex \
    && apk update \
    && apk add --no-cache libcouchbase=2.10.6-r0 \
    && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS libcouchbase-dev=2.10.6-r0 zlib-dev \
    && pecl update-channels \
    && pecl install couchbase-2.6.2 \
    && docker-php-ext-enable couchbase \
    && apk del .build-deps \
    && rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/src/php.tar.xz*

Disable Installed/Enabled PHP Extensions

Since 4.8.12+ and 5.0.1+, PHP extensions pdo_mysql and Redis are installed and enabled by default. If you want to disable them, you can use the following commands in your Dockerfile.

FROM phpswoole/swoole:4.8-alpine

RUN set -ex && \
    rm -f "$(php-config --ini-dir)/docker-php-ext-pdo_mysql.ini" && \
    rm -f "$(php-config --ini-dir)/docker-php-ext-redis.ini"

Note that above commands will remove the corresponding configuration files for the extensions, but won't remove the extensions themselves.

More Examples

Following examples are for non-Alpine images only. We don't have examples included for the Alpine images.

You can use the image to serve an HTTP/WebSocket server, or run some one-off command with it. e.g.,

docker run --rm phpswoole/swoole php -m
docker run --rm phpswoole/swoole php --ri swoole
docker run --rm phpswoole/swoole composer --version

We have various examples included under folder "examples/" to help developers better use the image. These examples are numerically ordered. Each example has a docker-compose.yml file included, along with some other files. To run an example, please start Docker containers using the docker-compose.yml file included, then check HTTP output from URL http://127.0.0.1 unless otherwise noted. You may use the following commands to start/stop/restart Docker containers:

./bin/example.sh start   00 # To start container(s) of the first example.
./bin/example.sh stop    00 # To stop container(s) of the first example.
./bin/example.sh restart 00 # To restart container(s) of the first example.

To run another example, just replace the last command line parameter 00 with an example number (e.g., 05).

Here is a list of the examples under folder "examples/":

  • Basic examples:
    • 00-autoreload: Restart the Swoole web server automatically if file changes detected under web root.
    • 01-basic: print out "Hello, World!" using Swoole as backend HTTP server.
    • 02-www: to use some customized PHP script(s) in the Docker image built.
    • 03-nginx: to use Swoole behind an Nginx server.
    • 04-entrypoint: to use a self-defined entrypoint script in the Docker image built.
    • 05-boot: to update content in the Docker container through a booting script.
    • 06-update-token: to show how to update server configurations with built-in script update-token.sh.
    • 07-disable-default-server: Please check the docker-compose.yml file included to see show how to disable the default web server created with Swoole.
  • Manage PHP extensions and configurations:
    • 10-install-php-extension: how to install/enable PHP extensions.
    • 11-customize-extension-options: how to overwrite/customize PHP extension options.
    • 12-php.ini: how to overwrite/customize PHP options.
    • 13-install-swoole-extension: Please check the README file included to see how to install Swoole extensions like async, orm, postgresql, and serialize.
    • 14-install-phpx: Please check the README file included to see how to install PHP-X.
    • 15-install-phpx-extension: Please check the README file included to see how to install PHP-X based extensions like zookeeper.
  • Manage Supervisord programs:
    • 20-supervisord-services: to show how to run Supervisord program(s) in Docker.
    • 21-supervisord-tasks: to show how to run Supervisord program(s) when launching a one-off command with Docker. Please check the README file included to see how to run the example.
    • 22-supervisord-enable-program: to show how to enable program(s) in Supervisord program.
    • 23-supervisord-disable-program: to show how to disable Supervisord program(s).
    • 24-supervisord-gracefully-shutdown: how to gracefully stop Swoole servers (managed by supervisord) in Docker containers.
  • Debugging:
    • 30-debug-with-gdb: Please check the README file included to see how to debug your PHP code with gdb.
    • 31-debug-with-valgrind: Please check the README file included to see how to debug your PHP code with Valgrind.
    • 32-debug-with-strace: Please check the README file included to see how to debug your PHP code with strace.
    • 33-debug-with-blackfire: Please check the README file included to see how to debug your PHP code with Blackfire.
    • 34-debug-with-xdebug: Please check the README file included to see how to debug your PHP code using Xdebug. Please note that Xdebug 3.1.0+ works with Swoole 5.0.2+ on PHP 8.1+ only. Lower versions of Xdebug don't work with Swoole.

Image Variants

The phpswoole/swoole images come in three flavors, each designed for a specific use case. In production environment, we suggest using the Alpine images.

1. latest, <swoole-version>, and <swoole-version>-php<php-version>

  • phpswoole/swoole:latest
  • phpswoole/swoole:5.1
  • phpswoole/swoole:5.1-php8.2
  • phpswoole/swoole:5.1.2-php8.2

This variant is based on the php:cli images, with a few changes. It uses Supervisord to manage booting processes, and has Composer preinstalled.

2. latest-dev, <swoole-version>-dev, and <swoole-version>-php<php-version>-dev

  • phpswoole/swoole:latest-dev
  • phpswoole/swoole:5.1-dev
  • phpswoole/swoole:5.1-php8.2-dev
  • phpswoole/swoole:5.1.2-php8.2-dev

This variant is very similar to the previous one, but it has extra tools added for testing, debugging, and monitoring purpose, including gdb, git, lsof, strace, tcpdump, Valgrind, and vim.

3. latest-alpine, <swoole-version>-alpine, and <swoole-version>-php<php-version>-alpine

  • phpswoole/swoole:latest-alpine
  • phpswoole/swoole:5.1-alpine
  • phpswoole/swoole:5.1-php8.2-alpine
  • phpswoole/swoole:5.1.2-php8.2-alpine

You can use this variant in the same way as using the php:alpine image, except that we changed the default working directory to /var/www. Also, we have Composer preinstalled in the image.

Note: We don't have development tools built in for Alpine images. There is no Docker images like phpswoole/swoole:5.1.2-php8.2-alpine-dev.

Supported Tags and Respective Dockerfile Links

Versioned images (based on stable releases of Swoole)

Swoole 5.1

PHP Versions Default Images Dev Images Alpine Images
PHP 8.3 5.1.2-php8.3, 5.1-php8.3 5.1.2-php8.3-dev, 5.1-php8.3-dev 5.1.2-php8.3-alpine, 5.1-php8.3-alpine
PHP 8.2 5.1.2-php8.2, 5.1-php8.2,
5.1, latest
5.1.2-php8.2-dev, 5.1-php8.2-dev,
5.1-dev, latest-dev
5.1.2-php8.2-alpine, 5.1-php8.2-alpine,
5.1-alpine, latest-alpine
PHP 8.1 5.1.2-php8.1, 5.1-php8.1 5.1.2-php8.1-dev, 5.1-php8.1-dev 5.1.2-php8.1-alpine, 5.1-php8.1-alpine
PHP 8.0 5.1.2-php8.0, 5.1-php8.0 5.1.2-php8.0-dev, 5.1-php8.0-dev 5.1.2-php8.0-alpine, 5.1-php8.0-alpine

Swoole 5.0

PHP Versions Default Images Dev Images Alpine Images
PHP 8.2 5.0.3-php8.2, 5.0-php8.2 5.0.3-php8.2-dev, 5.0-php8.2-dev 5.0.3-php8.2-alpine, 5.0-php8.2-alpine
PHP 8.1 5.0.3-php8.1, 5.0-php8.1,
5.0
5.0.3-php8.1-dev, 5.0-php8.1-dev,
5.0-dev
5.0.3-php8.1-alpine, 5.0-php8.1-alpine,
5.0-alpine
PHP 8.0 5.0.3-php8.0, 5.0-php8.0 5.0.3-php8.0-dev, 5.0-php8.0-dev 5.0.3-php8.0-alpine, 5.0-php8.0-alpine

Swoole 4.8

PHP Versions Default Images Dev Images Alpine Images
PHP 8.2 4.8.13-php8.2, 4.8-php8.2 4.8.13-php8.2-dev, 4.8-php8.2-dev 4.8.13-php8.2-alpine, 4.8-php8.2-alpine
PHP 8.1 4.8.13-php8.1, 4.8-php8.1 4.8.13-php8.1-dev, 4.8-php8.1-dev 4.8.13-php8.1-alpine, 4.8-php8.1-alpine
PHP 8.0 4.8.13-php8.0, 4.8-php8.0,
4.8
4.8.13-php8.0-dev, 4.8-php8.0-dev,
4.8-dev
4.8.13-php8.0-alpine, 4.8-php8.0-alpine,
4.8-alpine
PHP 7.4 4.8.13-php7.4, 4.8-php7.4 4.8.13-php7.4-dev, 4.8-php7.4-dev 4.8.13-php7.4-alpine, 4.8-php7.4-alpine
PHP 7.3 4.8.13-php7.3, 4.8-php7.3 4.8.13-php7.3-dev, 4.8-php7.3-dev 4.8.13-php7.3-alpine, 4.8-php7.3-alpine
PHP 7.2 4.8.13-php7.2, 4.8-php7.2 4.8.13-php7.2-dev, 4.8-php7.2-dev 4.8.13-php7.2-alpine, 4.8-php7.2-alpine

Swoole 4.7

PHP Versions Default Images Dev Images Alpine Images
PHP 8.0 4.7.1-php8.0, 4.7-php8.0,
4.7
4.7.1-php8.0-dev, 4.7-php8.0-dev,
4.7-dev
4.7.1-php8.0-alpine, 4.7-php8.0-alpine,
4.7-alpine
PHP 7.4 4.7.1-php7.4, 4.7-php7.4 4.7.1-php7.4-dev, 4.7-php7.4-dev 4.7.1-php7.4-alpine, 4.7-php7.4-alpine
PHP 7.3 4.7.1-php7.3, 4.7-php7.3 4.7.1-php7.3-dev, 4.7-php7.3-dev 4.7.1-php7.3-alpine, 4.7-php7.3-alpine
PHP 7.2 4.7.1-php7.2, 4.7-php7.2 4.7.1-php7.2-dev, 4.7-php7.2-dev 4.7.1-php7.2-alpine, 4.7-php7.2-alpine

Swoole 4.6

PHP Versions Default Images Dev Images Alpine Images
PHP 8.0 4.6.7-php8.0, 4.6-php8.0,
4.6
4.6.7-php8.0-dev, 4.6-php8.0-dev,
4.6-dev
4.6.7-php8.0-alpine, 4.6-php8.0-alpine,
4.6-alpine
PHP 7.4 4.6.7-php7.4, 4.6-php7.4 4.6.7-php7.4-dev, 4.6-php7.4-dev 4.6.7-php7.4-alpine, 4.6-php7.4-alpine
PHP 7.3 4.6.7-php7.3, 4.6-php7.3 4.6.7-php7.3-dev, 4.6-php7.3-dev 4.6.7-php7.3-alpine, 4.6-php7.3-alpine
PHP 7.2 4.6.7-php7.2, 4.6-php7.2 4.6.7-php7.2-dev, 4.6-php7.2-dev 4.6.7-php7.2-alpine, 4.6-php7.2-alpine

Swoole 4.5

PHP Versions Default Images Dev Images Alpine Images
PHP 8.0 4.5.11-php8.0, 4.5-php8.0,
4.5
4.5.11-php8.0-dev, 4.5-php8.0-dev,
4.5-dev
4.5.11-php8.0-alpine, 4.5-php8.0-alpine,
4.5-alpine
PHP 7.4 4.5.11-php7.4, 4.5-php7.4 4.5.11-php7.4-dev, 4.5-php7.4-dev 4.5.11-php7.4-alpine, 4.5-php7.4-alpine
PHP 7.3 4.5.11-php7.3, 4.5-php7.3 4.5.11-php7.3-dev, 4.5-php7.3-dev 4.5.11-php7.3-alpine, 4.5-php7.3-alpine
PHP 7.2 4.5.11-php7.2, 4.5-php7.2 4.5.11-php7.2-dev, 4.5-php7.2-dev 4.5.11-php7.2-alpine, 4.5-php7.2-alpine
PHP 7.1 4.5.11-php7.1, 4.5-php7.1 4.5.11-php7.1-dev, 4.5-php7.1-dev 4.5.11-php7.1-alpine, 4.5-php7.1-alpine

Swoole 4.4

PHP Versions Default Images Dev Images Alpine Images
PHP 7.4 4.4.25-php7.4, 4.4-php7.4,
4.4
4.4.25-php7.4-dev, 4.4-php7.4-dev,
4.4-dev
4.4.25-php7.4-alpine, 4.4-php7.4-alpine,
4.4-alpine
PHP 7.3 4.4.25-php7.3, 4.4-php7.3 4.4.25-php7.3-dev, 4.4-php7.3-dev 4.4.25-php7.3-alpine, 4.4-php7.3-alpine
PHP 7.2 4.4.25-php7.2, 4.4-php7.2 4.4.25-php7.2-dev, 4.4-php7.2-dev 4.4.25-php7.2-alpine, 4.4-php7.2-alpine
PHP 7.1 4.4.25-php7.1, 4.4-php7.1 4.4.25-php7.1-dev, 4.4-php7.1-dev 4.4.25-php7.1-alpine, 4.4-php7.1-alpine

Nightly images (built daily using the master branch of swoole-src)

PHP Versions Default Images Dev Images Alpine Images
PHP 8.3 php8.3 php8.3-dev php8.3-alpine
PHP 8.2 php8.2 php8.2-dev php8.2-alpine
PHP 8.1 php8.1 php8.1-dev php8.1-alpine
PHP 8.0 php8.0 php8.0-dev php8.0-alpine

Build Images Manually

The Docker images are built and pushed out automatically through Travis. If you want to build some image manually, please follow these three steps.

1. Install Composer packages. If you have command "composer" installed already, just run composer update -n.

2. Use commands like following to create dockerfiles:

./bin/generate-dockerfiles.php nightly # Generate dockerfiles to build images from the master branch of Swoole.
./bin/generate-dockerfiles.php 5.1.2   # Generate dockerfiles to build images for Swoole 5.1.2.

3. Build Docker images with commands like:

docker build -t phpswoole/swoole:php8.2              -f dockerfiles/nightly/php8.2/cli/Dockerfile   .
docker build -t phpswoole/swoole:5.1.2-php8.2        -f dockerfiles/5.1.2/php8.2/cli/Dockerfile    .
docker build -t phpswoole/swoole:5.1.2-php8.2-alpine -f dockerfiles/5.1.2/php8.2/alpine/Dockerfile .

To build development images (where extra tools are included), add an argument DEV_MODE:

docker build --build-arg DEV_MODE=true -t phpswoole/swoole:php8.2-dev       -f dockerfiles/nightly/php8.2/cli/Dockerfile .
docker build --build-arg DEV_MODE=true -t phpswoole/swoole:5.1.2-php8.2-dev -f dockerfiles/5.1.2/php8.2/cli/Dockerfile  .

Credits

  • Current implementation borrows ideas from Demin's work at Glu Mobile.
  • Thanks to Blackfire for providing free open-source subscription for their awesome profiling tool.

docker-swoole's People

Contributors

betashepherd avatar cexll avatar cjx2328 avatar deminy avatar garveen avatar matyhtf avatar mgttt avatar sy-records avatar twose avatar yangchaogit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-swoole's Issues

phpswoole/swoole:php8.2-dev won't install php extensions via docker-php-ext-install

Dockerfile to test

FROM phpswoole/swoole:php8.2-dev

RUN docker-php-ext-install pcntl

and run

docker build -t testphpswoole .

expected result (as for phpswoole/swoole image)

STEP 2/2: RUN     docker-php-ext-install pcntl
Configuring for:
PHP Api Version:         20210902
Zend Module Api No:      20210902
Zend Extension Api No:   420210902
# more logs
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20210902/
# ...
COMMIT testphpswoole
--> Pushing cache
# ...

actual result

STEP 2/2: RUN     docker-php-ext-install pcntl
Configuring for:
PHP Api Version:         20220829
Zend Module Api No:      20220829
Zend Extension Api No:   420220829
# ...
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20220829/
/usr/local/bin/docker-php-ext-enable: 5: cd: can't cd to [2023-07-11 05:24:22 @2052.0]  TRACE   Context::Context(:53): alloc stack: size=2097152, ptr=0x7ffa01001010
/usr/local/lib/php/extensions/no-debug-non-zts-20220829
Error: building at STEP "RUN docker-php-ext-install pcntl": while running runtime: exit status 123

A reason is an additional log in script https://github.com/docker-library/php/blob/6cb0a331566b66ae30c14884cc93cd2b3218d324/docker-php-ext-enable#L4

May be it's possible to advise how to install php extension to dev image of phpswoole

Inability to read from stdout or stderr in worker scripts

I faced an issue where Symfony's Process library wasn't able to read from the output of executed commands.

symfony/symfony#38256

As stated

FROM phpswoole/swoole:4.4.16-php7.3 and FROM phpswoole/swoole:4.4.16-php7.2 both did work. FROM phpswoole/swoole:4.4.16-php7.4 does not.

Simply crossposting here. I'm aware this might be an issue related to PHP itself.

Update images

Hello, can we have some newer builds with more recent php versions?

Possibly to combat #17

Thanks

Error deploying last version

Hi, thank you for this docker image.

I deploy my Laravel application on Google Run, and I used to use the last version phpswoole/swoole:php8.0-alpine which happened to work until this month.

Everytime I build my app with this image, from yesterday, I got 503 page.

Now I use the previous version phpswoole/swoole:4.7-php8.0-alpine and it works perfectly, like before.

Hashes:
Last versions:
sha256:a86d09eba2941db0e6a8424086b7012133f7a43626f00fd14667ab6ca4c302b6: doesnt work
sha256:4d43d47178801ff1dbbeb2230e59547a138f50c5a631951a841678de4106b484: works (31 oct)

4.7:
sha256:8f6cb15d6c0b2ae79ddf51c61d09fb4c70126794ff1cc4e500d4478a8ca03ac1: works

Thank you

Why no php 7.4 image?

Since the release of php 7.4 is already some time ago, why are there no php 7.4 images?

Alpine 3.16 Update

Is there a particular reason why alpine docker files use php:8.1.8-cli-alpine3.15 image?

I could propose a PR with 3.16 version.

example 00 cannot run as expected

example 00 cannot run as expected, if I configured like this:
volumes:
- ./rootfilesystem/var/www:/var/www

when I configure with this volumn, 80 port not work; But it's ok when I remove the config.

Investigate Performance Disparity: Benchmarks of Swoole PHP in Alpine vs. Ubuntu Images

I conducted performance benchmarks on a simple Swoole PHP "hello world" application, comparing its requests per second (RPS) on both an Ubuntu image and an Alpine image.

Surprisingly, the Ubuntu image yielded 35,000 RPS, while the Alpine image only achieved 15,000 RPS.

I'm seeking an explanation for this significant performance difference.
Metrics suggest that Alpine may be negatively impacting performance.

Any insights or explanations would be greatly appreciated!

Issue with Deployment on K8S

Hi, when deploying on K8s,
It shows that deployment is successful, All workers are started but when i visit the http://my-app/ it shows an error An unexpected error occurred and a 500 on the logs
When i deploy this on a dokku server for example, it works fine
I am using the phpswoole/swoole:4.6.7-php8.0 as base for my docker image
And am running mezzio-swole

Cannot install any extension on -dev tags

I was looking for a image that support arm64 and the only option was phpswoole/swoole:php8.1-dev

The problem i was no able to install any php extension on this image:

docker run -it phpswoole/swoole:php8.1-dev bash

docker-php-ext-install zip

latest lines:

+ strip --strip-all modules/zip.so
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20210902/
/usr/local/bin/docker-php-ext-enable: 5: cd: can't cd to [2023-05-19 14:00:22 @3003.0]  TRACE   Context::Context(:53): alloc stack: size=2097152, ptr=0x7fb41d589010
/usr/local/lib/php/extensions/no-debug-non-zts-20210902

using Yasd widh curl or requests form browser / PHPStorm

Hey, I am using a dockerized environment with:

  1. laravel octan (swoole)
  2. nginx to soole
  3. traefik for reverse proxy

I am able to use Yasd with the following settings:

[yasd]
yasd.debug_mode=remote
yasd.remote_host=172.17.0.1
yasd.remote_port=9000

If I run php -e test.ph in the container PHPStorm is hitting the break points.

As written in https://github.com/swoole/docker-swoole/tree/master/examples/35-debug-with-yasd I should be able to debug curl requests and browser requests from outside the container.

I started the entire server with the e-flag:

php -e artisan octane:start --server="swoole" --host="0.0.0.0" --workers=auto --task-workers=auto --max-requests=500

Is there anything else I need to do, to debug requests?

edit: Even after accessing the container directly (without trafik / nginx) it is not possible to call the debugger via curl:

swoole-dev:
    build:
        context: ./devOps/api/docker/dev/swoole/
        dockerfile: Dockerfile
    environment:
        PHP_IDE_CONFIG: "serverName=myServer"
        SHELL: /bin/sh
    ports:
        - "80:80"
    volumes:
        - ./app/api:/app
        - ./devOps/api/docker/dev/swoole/conf/custom.ini:/usr/local/etc/php/conf.d/custom.ini
    env_file:
        - ./devOps/api/docker/dev/etc/environment.env
    logging:
        driver: "json-file"
        options:
            max-size: "5m"

Run example.sh command throw error.

When i tried to run an example command, e.g., './bin/example.sh start 01 ' , i had got an error message like that.

find: warning: you have specified the -depth option after a non-option argument -type, but options are not positional (-depth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
find: paths must precede expression: `1'

When i had replaced file ./bin/example.sh line 20 find examples -type d -depth 1 -name "${2}-*" with find examples -type d -name "${2}-*" , it worked.

Failed to watch /var/www; upper limit on inotify watches reached!

I'm using the auto-reload example and I get this after a few changes in files

Failed to watch /var/www; upper limit on inotify watches reached!
Please increase the amount of inotify watches allowed per user via `/proc/sys/fs/inotify/max_user_watches'.
swoole: ERROR (not running)

Swoole alpine php8.3 composer fails with a segfault

Hello, after updating the alpine php base image to v8.3.0, ext-swoole is installed and the application is running, but composer can neither install nor update.

  1. What did you do? If possible, provide a simple script for reproducing the error.
docker run -it --rm phpswoole/swoole:php8.3-alpine sh
composer init

Define any dependency or try to require later, e.g.:

composer require roave/security-advisories
  1. What did you expect to see?

Composer installation

  1. What did you see instead?

Segmentation fault

  1. What version of Swoole are you using (show your php --ri swoole)?

Swoole => enabled
Author => Swoole Team [email protected]
Version => 5.1.1
Built => Nov 27 2023 04:49:08
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 3.1.4 24 Oct 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled
coroutine_pgsql => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

docker build 报错!

=> ERROR [2/4] COPY ./rootfilesystem/ / 0.0s

[2/4] COPY ./rootfilesystem/ /:


failed to compute cache key: "/rootfilesystem" not found: not found

> 300MB RAM usage on server start (Docker/Octane)

With this dockerfile:

FROM phpswoole/swoole:php8.1

WORKDIR /var/www/html

COPY --from=composer /usr/bin/composer /usr/bin/composer

RUN composer create-project laravel/laravel .

RUN mv ./.env.example .env

RUN php artisan key:generate

RUN composer require laravel/octane

RUN php artisan octane:install --server=swoole

EXPOSE 9000

ENTRYPOINT ["/bin/bash", "-c", "php /var/www/html/artisan octane:start --server=swoole  --host=0.0.0.0 --port=9000 --max-requests=1500"]

docker build -t octane .

docker run -d -p 9000:9000 --name=dump octane

then docker stats and you will see:

image

As you can see when the server started with laravel octane it allocated 300 mb of ram, What cause this ? Or is it normal ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.