L
L
LakeForest2021-05-02 16:14:06
PHP
LakeForest, 2021-05-02 16:14:06

How to set up a Dockerfile to run a Commet PHP project with MongoDB?

You need to run this project: https://github.com/gotzmann/comet
I tried to run it with a dockerfile from the framework repository, but for some reason I launched it yesterday - today I cleared the cache, I run it - it doesn't work.
I began to display errors about mbstring ...

FROM php:7.4-cli
RUN apt-get update && apt-get install -y pkg-config libssl-dev libevent-dev
RUN pecl install event \
    && docker-php-ext-enable event
RUN docker-php-ext-install sockets \
    && pecl install mongodb-1.2.2 \
    && docker-php-ext-enable mongodb
RUN composer update
COPY ./client_shop/backend /var/www/
WORKDIR /var/www
CMD php ./src/app.php start


Mistake:
checking for /usr/local/include/php/ext/sockets/php_sockets.h... no
configure: error: Couldn't find /usr/local/include/php/sockets/php_sockets.h. Please check if sockets extension installed
ERROR: `/tmp/pear/temp/event/configure --with-php-config=/usr/local/bin/php-config --enable-event-debug=no --enable-event-sockets=yes --with-event-libevent-dir=/usr --with-event-pthreads=no --with-event-extra --with-event-openssl --with-event-ns=no --with-openssl-dir=no' failed
ERROR: Service 'shop' failed to build: The command '/bin/sh -c pecl install event     && docker-php-ext-enable event' returned a non-zero code: 1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
LakeForest, 2021-05-02
@LakeForest

FROM php:7.4-cli
RUN docker-php-ext-install sockets && apt-get update \
    && apt-get install -y libevent-dev libcurl4-openssl-dev pkg-config libssl-dev libonig-dev \
    && pecl install event mongodb \
    && docker-php-ext-enable event mongodb \
    && docker-php-ext-install mbstring pcntl
COPY ./client_shop/backend /var/www/
WORKDIR /var/www
CMD php ./src/app.php start

D
Dmitry, 2021-05-02
@q2digger

The original dockerfile has a slightly different look.
At least this is what
FROM ubuntu:20.04
you are using FROM php:7.4-cliobviously lacking something that the author has in standard ubunt.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question