openswoole / ext-openswoole

Programmatic server for PHP with async IO, coroutines and fibers
https://openswoole.com
Apache License 2.0
808 stars 51 forks source link

Way to integrate GD or Imagick extensions with docker compose #252

Closed WraShadow closed 2 years ago

WraShadow commented 2 years ago
  1. What did you do? If possible, provide a simple script for reproducing the error.
    
    I setup openswoole using docker-compose and I was trying to implement a image manipulation library but they seem to require either GD or Imagick, but I cannot seem to find a way to activate the extension.
2. What did you expect to see?

No error

3. What did you see instead?

ImageMagick module not available with this PHP installation. The same happens with GD.

4. What version of OpenSwoole are you using (show your `php --ri openswoole`)?

openswoole/swoole:4.11-php8.1


You can also try the following OpenSwoole support channels:

* [Documentation](https://openswoole.com/docs) - Documentation for Open Swoole
* [Slack](https://goo.gl/forms/wooTTDmhbu30x4qC3) - Slack channel of Open Swoole
* [Discord](https://discord.gg/5QC57RNPpw) - Discord server of Open Swoole
WraShadow commented 2 years ago

Is there anything else I can provide to help?

schalkt commented 2 years ago

Create a custom Dockerfile and use that in docker-compose.yml.

FROM openswoole/swoole:4.11-php8.1

# Enable extensions
RUN apt-get update && apt-get install -y --no-install-recommends libpng-dev \
    && docker-php-ext-install gd
swoole5:
        restart: unless-stopped
        build:
            context: [path-to-dockerfile]
            dockerfile: ./Dockerfile
WraShadow commented 2 years ago

Thank you. It worked.