dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.74k stars 226 forks source link

install-php-extensions is meant to be used with official Docker PHP Images #845

Closed ramonmalcolm10 closed 3 months ago

ramonmalcolm10 commented 4 months ago

What happened?

Not able to install any php extensions in Gitab ci/cd pipeline, however it work locally on my Macbook.

Build Type

Docker (Debian Bookworm)

Worker Mode

No

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

N/A

Relevant log output

bash
 FROM docker.io/dunglas/frankenphp:latest-php8.3@sha256:97fce37efebd6678013ecc3751e17af8b877cc8b59b7f31a0e7b8dffb0066fa7
#22 resolve docker.io/dunglas/frankenphp:latest-php8.3@sha256:97fce37efebd6678013ecc3751e17af8b877cc8b59b7f31a0e7b8dffb0066fa7 done
#22 sha256:6f36f21d4ba4052f6a123db906b22b9f6afafff577a3d5edbf5cdce8361323af 3.33kB / 3.33kB done
#22 sha256:97fce37efebd6678013ecc3751e17af8b877cc8b59b7f31a0e7b8dffb0066fa7 3.14kB / 3.14kB done
#22 sha256:827b85f70a215ab21e48092aceb46c12dd95adae927da1786c093596f97b7a61 13.57kB / 13.57kB done
#22 ...
#23 [stage-2 2/5] RUN install-php-extensions     pcntl     pdo_pgsql
#23 0.385 The script /usr/local/bin/install-php-extensions is meant to be used with official Docker PHP Images - https://hub.docker.com/_/php
#23 ERROR: executor failed running [/bin/sh -c install-php-extensions     pcntl     pdo_pgsql]: runc did not terminate sucessfully
#22 [stage-2 1/5] FROM docker.io/dunglas/frankenphp:latest-php8.3@sha256:97fce37efebd6678013ecc3751e17af8b877cc8b59b7f31a0e7b8dffb0066fa7
------
 > [stage-2 2/5] RUN install-php-extensions     pcntl     pdo_pgsql:
0.385 The script /usr/local/bin/install-php-extensions is meant to be used with official Docker PHP Images - https://hub.docker.com/_/php
------
ERROR: failed to solve: failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c install-php-extensions     pcntl     pdo_pgsql]: runc did not terminate sucessfully
dunglas commented 4 months ago

FrankenPHP does extend official PHP images, and contains the scripts used by this script: https://github.com/mlocati/docker-php-extension-installer/blob/6d18123abeae197fea75a8b26d7cf597c5f35543/install-php-extensions#L19

It looks like you use a custom Dockerfile, can you copy it?

ramonmalcolm10 commented 4 months ago

FrankenPHP does extend official PHP images, and contains the scripts used by this script: https://github.com/mlocati/docker-php-extension-installer/blob/6d18123abeae197fea75a8b26d7cf597c5f35543/install-php-extensions#L19

It looks like you use a custom Dockerfile, can you copy it?

ARG PHP_VERSION=8.3

ARG FRANKENPHP_VERSION=latest

FROM composer:latest as vendor

COPY ./composer.json /app/
COPY ./composer.lock /app/

RUN composer install --no-dev --no-autoloader --no-scripts --ignore-platform-reqs

COPY . /app

RUN composer install --no-dev --optimize-autoloader --ignore-platform-reqs

FROM oven/bun as frontend

WORKDIR /app

COPY package.json bun.lockb ./

RUN bun install

COPY vite.config.js ./
COPY resources/ ./resources/
COPY public/ ./public/

RUN bun run build

FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION}

RUN install-php-extensions \
    pcntl \
    pdo_pgsql

COPY --chown=www-data --from=vendor /app/ /app
COPY --chown=www-data --from=frontend /app/public/ /app/public/
COPY --chown=www-data --from=frontend /app/bootstrap/ssr/ /app/bootstrap/ssr/
COPY --chown=www-data --from=frontend /app/node_modules/ /app/node_modules/

ENTRYPOINT ["php", "artisan", "octane:frankenphp"]
AlliBalliBaba commented 3 months ago

The above Dockerfile builds for me, at least on Ubuntu amd64 and Docker 26.1.2. @ramonmalcolm10 what docker version are you using?

ramonmalcolm10 commented 2 months ago

The above Dockerfile builds for me, at least on Ubuntu amd64 and Docker 26.1.2. @ramonmalcolm10 what docker version are you using?

Was using Docker 26.1.2 on Debian

ramonmalcolm10 commented 2 months ago

Issue was resolved for me, I was using docker:19-dind instead of the latest version.