Skip to content

Commit f5ea514

Browse files
committed
Fixing CI
There's an issue with the downstream PPA "ondrej/php" where is cannot find the gearman package. Refactoring Dockerfile to use standard base images as a workaround
1 parent b474bb4 commit f5ea514

File tree

6 files changed

+33
-77
lines changed

6 files changed

+33
-77
lines changed

.github/workflows/ci.yml

+1-7
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,4 @@ jobs:
162162
env:
163163
PHP_VERSION: ${{ matrix.php }}
164164

165-
# TODO: convert these two steps into one w/o excludes when Gearman extension gets a release for PHP 8.1
166-
# See https://github.com/php/pecl-networking-gearman/issues/16
167-
- run: bin/test.sh
168-
if: ${{ matrix.php != '8.1' && matrix.php != '8.2' }}
169-
170-
- run: bin/test.sh --exclude-group=gearman
171-
if: ${{ matrix.php == '8.1' && matrix.php != '8.2' }}
165+
- run: bin/test.sh --group=functional

docker-compose.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
version: '2'
2-
31
services:
42
dev:
53
# when image publishing gets sorted:
6-
# image: enqueue/dev:${PHP_VERSION:-7.4}
4+
# image: enqueue/dev:${PHP_VERSION:-8.2}
75
build:
86
context: docker
97
args:
10-
PHP_VERSION: "${PHP_VERSION:-8.1}"
8+
PHP_VERSION: "${PHP_VERSION:-8.2}"
119
depends_on:
1210
- rabbitmq
1311
- mysql

docker/Dockerfile

+27-64
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,39 @@
11
ARG PHP_VERSION=8.2
2-
FROM makasim/nginx-php-fpm:${PHP_VERSION}-all-exts
2+
FROM php:${PHP_VERSION}-alpine
33

44
ARG PHP_VERSION
55

6-
## libs
7-
RUN set -x && \
8-
apt-get update && \
9-
apt-get install -y --no-install-recommends --no-install-suggests \
10-
wget \
11-
curl \
12-
openssl \
13-
ca-certificates \
14-
nano \
15-
netcat \
16-
php${PHP_VERSION}-dev \
17-
php${PHP_VERSION}-redis \
18-
php${PHP_VERSION}-pgsql \
19-
git \
20-
python \
21-
php${PHP_VERSION}-amqp \
22-
php${PHP_VERSION}-xml \
23-
php${PHP_VERSION}-mysql \
24-
php${PHP_VERSION}-curl \
25-
php${PHP_VERSION}-mongodb \
26-
php${PHP_VERSION}-mbstring \
27-
make \
28-
g++ \
29-
unzip \
30-
&& \
31-
update-alternatives --install /usr/bin/php php /usr/bin/php${PHP_VERSION} 100
32-
33-
## gearman
34-
RUN set -x && \
35-
apt-get install -y --no-install-recommends --no-install-suggests \
36-
libgearman-dev \
37-
&& \
38-
mkdir -p $HOME/gearman && \
39-
cd $HOME/gearman && \
40-
git clone https://github.com/php/pecl-networking-gearman.git . && \
41-
git checkout gearman-2.1.0 && \
42-
phpize && ./configure && make && make install && \
43-
if [ ! -f /etc/php/${PHP_VERSION}/cli/conf.d/20-gearman.ini ]; then \
44-
echo "extension=gearman.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-gearman.ini && \
45-
echo "extension=gearman.so" > /etc/php/${PHP_VERSION}/fpm/conf.d/20-gearman.ini \
46-
; \
47-
fi;
48-
49-
## librdkafka
50-
RUN set -x && \
51-
mkdir -p $HOME/librdkafka && \
52-
cd $HOME/librdkafka && \
53-
git clone https://github.com/edenhill/librdkafka.git . && \
54-
git checkout v1.0.0 && \
55-
./configure && make && make install
56-
57-
## php-rdkafka
58-
RUN set -x && \
59-
mkdir -p $HOME/php-rdkafka && \
60-
cd $HOME/php-rdkafka && \
61-
git clone https://github.com/arnaud-lb/php-rdkafka.git . && \
62-
git checkout 5.0.1 && \
63-
phpize && ./configure && make all && make install && \
64-
echo "extension=rdkafka.so" > /etc/php/${PHP_VERSION}/cli/conf.d/10-rdkafka.ini && \
65-
echo "extension=rdkafka.so" > /etc/php/${PHP_VERSION}/fpm/conf.d/10-rdkafka.ini
66-
67-
COPY ./php/cli.ini /etc/php/${PHP_VERSION}/cli/conf.d/1-dev_cli.ini
6+
RUN --mount=type=cache,target=/var/cache/apk apk add --no-cache $PHPIZE_DEPS \
7+
libpq-dev \
8+
librdkafka-dev \
9+
rabbitmq-c-dev \
10+
linux-headers && \
11+
apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing \
12+
gearman-dev
13+
14+
# Install First Party Modules
15+
RUN docker-php-ext-install -j$(nproc) \
16+
pcntl \
17+
pdo_mysql \
18+
pdo_pgsql
19+
20+
# Install Third Party Modules
21+
RUN --mount=type=cache,target=/tmp/pear pecl install redis \
22+
mongodb-1.21.0 \
23+
gearman \
24+
rdkafka \
25+
xdebug && \
26+
pecl install --configureoptions 'with-librabbitmq-dir="autodetect"' amqp
27+
RUN docker-php-ext-enable redis mongodb gearman rdkafka xdebug amqp
28+
29+
COPY ./php/cli.ini /usr/local/etc/php/conf.d/1-dev_cli
6830
COPY ./bin/dev_entrypoiny.sh /usr/local/bin/entrypoint.sh
31+
RUN mv /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
6932
RUN chmod u+x /usr/local/bin/entrypoint.sh
7033

7134
RUN mkdir -p /mqdev
7235
WORKDIR /mqdev
7336

7437
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
7538

76-
CMD /usr/local/bin/entrypoint.sh
39+
CMD ["/usr/local/bin/entrypoint.sh"]

docker/bin/dev_entrypoiny.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
while true; do sleep 1; done

docker/bin/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
# wait for service
44
# $1 host

pkg/rdkafka/Tests/RdKafkaConsumerTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ public function testShouldReceiveFromQueueAndReturnMessageIfMessageInQueue()
190190
$kafkaMessage = new Message();
191191
$kafkaMessage->err = \RD_KAFKA_RESP_ERR_NO_ERROR;
192192
$kafkaMessage->payload = 'theSerializedMessage';
193+
$kafkaMessage->partition = 0;
193194

194195
$kafkaConsumer = $this->createKafkaConsumerMock();
195196
$kafkaConsumer

0 commit comments

Comments
 (0)