Skip to content

Building the extension in Docker #3

Open
@zeroware

Description

@zeroware

Hello,

Here is a Dockerfile i'm trying to create to compile and test this extension with multiple PHP versions.
I run the testbed at the end to verify that the extension is working.

ARG PHP_VERSION_MAJOR=8
ARG PHP_VERSION_MINOR=1
ARG PHP_VERSION=$PHP_VERSION_MAJOR.$PHP_VERSION_MINOR

FROM php:$PHP_VERSION-zts-bookworm as php-git2-debian
ARG PHP_VERSION_MAJOR
ARG PHP_VERSION_MINOR
ARG PHP_VERSION
ARG PHP_GIT2_PHP_VERSION=php$PHP_VERSION_MAJOR
ARG PHP_GIT2_VERSION=v2.0.0

RUN apt-get update && \
    apt-get -y --no-install-recommends install \
    git \
    wget \
    libgit2-dev \
    unzip \
    && \
    apt-get clean

RUN cd /opt && \
    wget https://github.com/RogerGee/php-git2/archive/refs/tags/$PHP_GIT2_PHP_VERSION/$PHP_GIT2_VERSION.zip -O php-git2.zip && \
    unzip php-git2.zip && \
    cd /opt/php-git2-$PHP_GIT2_PHP_VERSION-$PHP_GIT2_VERSION && \
    phpize && \
    ./configure && \
    make &&  \
    make install && \
    rm /opt/php-git2.zip

RUN docker-php-ext-enable git2

FROM php-git2-debian as php-git2-debian-test

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

RUN git --global --add user.name root && \
    git --global --add user.email root@localhost \

RUN cd /opt/php-git2-$PHP_GIT2_PHP_VERSION-$PHP_GIT2_VERSION/testbed && \
    composer update && \
    composer install && \
    php main.php

The tests are failing on PHP 8.1 and 8.2 with the following errors :

There were 6 errors:

1) PhpGit2\Test\RemoteTest::testConnect
Git2Exception: libgit2 error: (12): unsupported URL protocol

/opt/php-git2-php8-v2.0.0/testbed/src/Test/RemoteTest.php:221

2) PhpGit2\Test\RemoteTest::testDownload
Git2Exception: libgit2 error: (12): unsupported URL protocol

/opt/php-git2-php8-v2.0.0/testbed/src/Test/RemoteTest.php:284

3) PhpGit2\Test\RemoteTest::testFetch
Git2Exception: libgit2 error: (12): unsupported URL protocol

/opt/php-git2-php8-v2.0.0/testbed/src/Test/RemoteTest.php:311

4) PhpGit2\Test\RemoteTest::testFetch_Default
Git2Exception: libgit2 error: (12): unsupported URL protocol

/opt/php-git2-php8-v2.0.0/testbed/src/Test/RemoteTest.php:324

5) PhpGit2\Test\RemoteTest::testPrune
Git2Exception: libgit2 error: (12): this remote has never connected

/opt/php-git2-php8-v2.0.0/testbed/src/Test/RemoteTest.php:397

6) PhpGit2\Test\RemoteTest::testUpdateTips
Git2Exception: libgit2 error: (12): this remote has never connected

/opt/php-git2-php8-v2.0.0/testbed/src/Test/RemoteTest.php:452

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions