Reputation: 2232
To be able to push notifications via WebSockets from PHP using Ratchet, I need to install ZeroMQ as stated in the documentation. However I didn't find any information about how to do it for Alpine Linux. Most of the time what we can find is with apt-get
, for example here. Same about the Docker images (Dockerfile) available on Docker hub.
Since the dependencies and their name seem different, how to do it with Alpine?
Upvotes: 2
Views: 2241
Reputation: 468
In php:8.0-fpm-alpine
, pecl install zmq-beta
threw an error and failed to compile, so I used this command:
FROM php:8.0-fpm-alpine
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN set -eux && \
apk add --update-cache --no-cache libzmq zeromq-dev zeromq && \
apk add --update-cache --no-cache --virtual=.build-php-dependencies \
autoconf gcc coreutils build-base git && \
git clone https://github.com/mkoppanen/php-zmq.git && \
cd php-zmq && \
phpize && \
./configure && \
make && \
make install && \
docker-php-ext-enable zmq && \
apk del .build-php-dependencies
Reference:
https://github.com/zeromq/php-zmq/issues/200#issuecomment-610161524
Upvotes: 2
Reputation: 2232
For those who face the same situation, I finally found how to do it:
FROM php:7-cli-alpine
RUN apk add autoconf gcc libzmq zeromq-dev zeromq coreutils build-base
RUN pecl install zmq-beta \
&& docker-php-ext-enable zmq
Source: https://smartango.com/2018/10/php-zmq-in-docker-and-checking-whether-the-c-compiler-works-no/
Upvotes: 2