frankenphp icon indicating copy to clipboard operation
frankenphp copied to clipboard

Application not loading after successful docker image build | Class "config" does not exist

Open RishabhBizi opened this issue 11 months ago • 9 comments

What happened?

I am trying to convert my laravel application to standalone binary. The docker image is building successfully but when I try to run the container and check it on browser I am getting the below issue even the website homepage is not loading.

My dockerfile is as follows:

FROM dunglas/frankenphp:static-builder AS build

WORKDIR /go/src/app/dist/app

COPY . .

RUN rm -rf ./bootstrap/cache/*.php

RUN chmod -R 775 ./bootstrap/cache
RUN chmod -R 775 ./storage

WORKDIR /go/src/app/

# RUN apt-get update && apt-get install -y git

# RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

ARG FRANKENPHP_VERSION=static-builder
ARG PHP_VERSION=8.2
ENV APP_NAME=Laravel
ENV APP_ENV=dev

RUN EMBED=dist/app/ \
    PHP_VERSION=${PHP_VERSION} \
    FRANKENPHP_VERSION=${FRANKENPHP_VERSION} \
    PHP_EXTENSIONS=zip,gd,pdo,pdo_mysql,opcache \
    NO_COMPRESS=1 ./build-static.sh


RUN ls /go/src/app/dist/

FROM alpine:3.19.0

WORKDIR /app

COPY --from=build /go/src/app/dist/frankenphp-linux-x86_64 laravel-php

RUN ls

EXPOSE 80

CMD ["./laravel-php","php-server"]

I am not getting what I am doing wrong or do I need to install anything else?

Build Type

Official static build

Worker Mode

Yes

Operating System

GNU/Linux

CPU Architecture

x86_64

PHP configuration

Application not able to load even

Relevant log output

Fatal error: Uncaught ReflectionException: Class "config" does not exist in /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php:889 Stack trace: #0 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(889): ReflectionClass->__construct('config') #1 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(770): Illuminate\Container\Container->build('config') #2 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(881): Illuminate\Container\Container->resolve('config', Array, true) #3 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(706): Illuminate\Foundation\Application->resolve('config', Array) #4 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(866): Illuminate\Container\Container->make('config', Array) #5 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(1431): Illuminate\Foundation\Application->make('config') #6 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(524): Illuminate\Container\Container->offsetGet('config') #7 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(575): Illuminate\Log\LogManager->getDefaultDriver() #8 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(122): Illuminate\Log\LogManager->parseDriver(NULL) #9 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(645): Illuminate\Log\LogManager->driver() #10 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->error('Call to undefin...', Array) #11 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/app/Exceptions/Handler.php(38): Illuminate\Foundation\Exceptions\Handler->report(Object(Error)) #12 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(481): App\Exceptions\Handler->report(Object(Error)) #13 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\Foundation\Http\Kernel->reportException(Object(Error)) #14 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #15 {main} Next Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist. in /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php:891 Stack trace: #0 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(770): Illuminate\Container\Container->build('config') #1 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(881): Illuminate\Container\Container->resolve('config', Array, true) #2 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(706): Illuminate\Foundation\Application->resolve('config', Array) #3 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(866): Illuminate\Container\Container->make('config', Array) #4 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php(1431): Illuminate\Foundation\Application->make('config') #5 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(524): Illuminate\Container\Container->offsetGet('config') #6 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(575): Illuminate\Log\LogManager->getDefaultDriver() #7 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(122): Illuminate\Log\LogManager->parseDriver(NULL) #8 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(645): Illuminate\Log\LogManager->driver() #9 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->error('Call to undefin...', Array) #10 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/app/Exceptions/Handler.php(38): Illuminate\Foundation\Exceptions\Handler->report(Object(Error)) #11 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(481): App\Exceptions\Handler->report(Object(Error)) #12 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\Foundation\Http\Kernel->reportException(Object(Error)) #13 /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #14 {main} thrown in /tmp/frankenphp_22b0edd383bc13eabf6ffc9cdf63ee70/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 891

RishabhBizi avatar Feb 04 '25 11:02 RishabhBizi

And you are using Laravel with Octane? What does your Caddyfile look like? I think it needs to be at the root of the repo when building like this.

AlliBalliBaba avatar Feb 05 '25 17:02 AlliBalliBaba

@AlliBalliBaba I am using it with Laravel only. I haven't installed Octane or anything. Do I need to install Octane to my existing Laravel project?

RishabhBizi avatar Feb 06 '25 09:02 RishabhBizi

No you don't need Octane, I was just assuming you were using it since it's needed for worker mode. I think you might just have to clear the Laravel bootstrap cache with php artisan optimize:clear before building or ./laravel-php php-cli artisan optimize after building the binary.

AlliBalliBaba avatar Feb 06 '25 10:02 AlliBalliBaba

@AlliBalliBaba I ran the ./laravel-php php-cli artisan optimize after building the binary but I am getting the same issue

> [stage-1 4/4] RUN ./laravel-php php-cli artisan optimize:
4.638
4.638 Fatal error: Uncaught ReflectionException: Class "config" does not exist in /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php:889
4.638 Stack trace:
4.638 #0 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(889): ReflectionClass->__construct('config')
4.638 #1 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(770): Illuminate\Container\Container->build('config')
4.638 #2 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(881): Illuminate\Container\Container->resolve('config', Array, true)
4.638 #3 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(706): Illuminate\Foundation\Application->resolve('config', Array)
4.638 #4 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(866): Illuminate\Container\Container->make('config', Array)
4.638 #5 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(1431): Illuminate\Foundation\Application->make('config')
4.638 #6 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(524): Illuminate\Container\Container->offsetGet('config')
4.638 #7 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(575): Illuminate\Log\LogManager->getDefaultDriver()
4.638 #8 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(122): Illuminate\Log\LogManager->parseDriver(NULL)
4.638 #9 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(645): Illuminate\Log\LogManager->driver()
4.638 #10 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->error('Call to undefin...', Array)
4.638 #11 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/app/Exceptions/Handler.php(38): Illuminate\Foundation\Exceptions\Handler->report(Object(Error))
4.638 #12 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(454): App\Exceptions\Handler->report(Object(Error))
4.638 #13 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(157): Illuminate\Foundation\Console\Kernel->reportException(Object(Error))
4.638 #14 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
4.638 #15 {main}
4.638
4.638 Next Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist. in /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php:891
4.638 Stack trace:
4.638 #0 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(770): Illuminate\Container\Container->build('config')
4.638 #1 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(881): Illuminate\Container\Container->resolve('config', Array, true)
4.638 #2 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(706): Illuminate\Foundation\Application->resolve('config', Array)
4.638 #3 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(866): Illuminate\Container\Container->make('config', Array)
4.638 #4 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php(1431): Illuminate\Foundation\Application->make('config')
4.638 #5 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(524): Illuminate\Container\Container->offsetGet('config')
4.638 #6 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(575): Illuminate\Log\LogManager->getDefaultDriver()
4.638 #7 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(122): Illuminate\Log\LogManager->parseDriver(NULL)
4.638 #8 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(645): Illuminate\Log\LogManager->driver()
4.638 #9 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->error('Call to undefin...', Array)
4.638 #10 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/app/Exceptions/Handler.php(38): Illuminate\Foundation\Exceptions\Handler->report(Object(Error))
4.638 #11 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(454): App\Exceptions\Handler->report(Object(Error))
4.638 #12 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(157): Illuminate\Foundation\Console\Kernel->reportException(Object(Error))
4.638 #13 /tmp/frankenphp_b6efaec97d2f9c141603942386820562/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
4.638 #14 {main}
4.638   thrown in /tmp/frankenphp_b6efaec97d2f9c141603942386820562/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 891
------
Dockerfile:38
--------------------
  36 |     COPY --from=build /go/src/app/dist/frankenphp-linux-x86_64 laravel-php
  37 |
  38 | >>> RUN ./laravel-php php-cli artisan optimize
  39 |
  40 |     EXPOSE 80
--------------------
ERROR: failed to solve: process "/bin/sh -c ./laravel-php php-cli artisan optimize" did not complete successfully: exit code: 255

RishabhBizi avatar Feb 06 '25 12:02 RishabhBizi

@RishabhBizi I tried installing with your Dockerfile and think I found what the issue is. Composer needs some additional php extensions in order to function, this worked for me (I added phar,filter,iconv,openssl):

RUN EMBED=dist/app/ \
    PHP_VERSION=${PHP_VERSION} \
    FRANKENPHP_VERSION=${FRANKENPHP_VERSION} \
    PHP_EXTENSIONS=zip,gd,pdo,pdo_mysql,opcache,phar,filter,iconv,openssl \
    NO_COMPRESS=1 ./build-static.sh

AlliBalliBaba avatar Feb 07 '25 20:02 AlliBalliBaba

@AlliBalliBaba I applied your changes but now it's breaking at the line RUN ./laravel-php php-cli artisan optimize in the docker file

Error:

 => ERROR [stage-1 4/4] RUN ./laravel-php php-cli artisan optimize                                                                       3.8s 
------
 > [stage-1 4/4] RUN ./laravel-php php-cli artisan optimize:
3.353
3.353    Error
3.353
3.353   Class "DOMDocument" not found
3.353
3.353   at /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/termwind/src/HtmlRenderer.php:32
3.354
3.354    Error
3.354
3.354   Call to undefined function NunoMaduro\Collision\token_get_all()
3.354
3.354   at /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Highlighter.php:155
3.354
3.354    Symfony\Component\ErrorHandler\Error\FatalError
3.354
3.354   Uncaught Error: Call to undefined function NunoMaduro\Collision\token_get_all() in /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Highlighter.php:155
3.354 Stack trace:
3.354 #0 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Highlighter.php(145): NunoMaduro\Collision\Highlighter->tokenize('<?php\n\ndeclare(...')
3.354 #1 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Highlighter.php(127): NunoMaduro\Collision\Highlighter->getHighlightedLines('<?php\n\ndeclare(...')
3.354 #2 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Highlighter.php(116): NunoMaduro\Collision\Highlighter->getCodeSnippet('<?php\n\ndeclare(...', 155, 4, 4)
3.354 #3 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Writer.php(280): NunoMaduro\Collision\Highlighter->highlight('<?php\n\ndeclare(...', 155)
3.354 #4 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Writer.php(120): NunoMaduro\Collision\Writer->renderEditor(Object(Whoops\Exception\Frame))
3.354 #5 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Handler.php(39): NunoMaduro\Collision\Writer->write(Object(Whoops\Exception\Inspector))
3.354 #6 /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/filp/whoops/src/Whoops/Run.php(398): NunoMaduro\Collision\Handler->handle(Object(Error))
3.354 #7 [internal function]: Whoops\Run->handleException(Object(Error))
3.354 #8 {main}
3.354   thrown
3.354
3.354   at /tmp/frankenphp_ae9985e60d9af2d957556f3ae90d902b/vendor/nunomaduro/collision/src/Highlighter.php:155
------
Dockerfile:38
--------------------
  36 |     COPY --from=build /go/src/app/dist/frankenphp-linux-x86_64 laravel-php
  37 |
  38 | >>> RUN ./laravel-php php-cli artisan optimize
  39 |
  40 |     EXPOSE 80
--------------------
ERROR: failed to solve: process "/bin/sh -c ./laravel-php php-cli artisan optimize" did not complete successfully: exit code: 255

RishabhBizi avatar Feb 10 '25 05:02 RishabhBizi

This looks like you also need either the dom extension or the xml extension.

AlliBalliBaba avatar Feb 10 '25 07:02 AlliBalliBaba

@AlliBalliBaba I tried it with both dom and xml extention but still getting the below error:

88.80 /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: encoding.c:(.text+0x27b3): undefined reference to `ucnv_close_76'
88.80 /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: encoding.c:(.text+0x2839): undefined reference to `ucnv_close_76'
88.80 /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: encoding.c:(.text+0x2842): undefined reference to `ucnv_close_76'
88.80 /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: encoding.c:(.text+0x2869): undefined reference to `ucnv_close_76'
88.80 /usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /go/src/app/dist/static-php-cli/buildroot/lib/libxml2.a(encoding.c.o):encoding.c:(.text+0x2873): more undefined references to `ucnv_close_76' follow
89.03 collect2: error: ld returned 1 exit status
89.03 [10:19:19] [ERRO] Uncaught SPC\exception\RuntimeException: embed failed sanity check: build failed. Error message:  at /go/src/app/dist/static-php-cli/src/SPC/builder/unix/UnixBuilderBase.php(194)
89.03 [10:19:19] [ERRO] #0 /go/src/app/dist/static-php-cli/src/SPC/builder/linux/LinuxBuilder.php(208): SPC\builder\unix\UnixBuilderBase->sanityCheck()
89.03 #1 /go/src/app/dist/static-php-cli/src/SPC/command/BuildCliCommand.php(180): SPC\builder\linux\LinuxBuilder->buildPHP()
89.03 #2 /go/src/app/dist/static-php-cli/src/SPC/command/BaseCommand.php(107): SPC\command\BuildCliCommand->handle()
89.03 #3 /go/src/app/dist/static-php-cli/vendor/symfony/console/Command/Command.php(326): SPC\command\BaseCommand->execute()
89.03 #4 /go/src/app/dist/static-php-cli/vendor/symfony/console/Application.php(1078): Symfony\Component\Console\Command\Command->run()       
89.03 #5 /go/src/app/dist/static-php-cli/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()   
89.03 #6 /go/src/app/dist/static-php-cli/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
89.03 #7 /go/src/app/dist/static-php-cli/bin/spc(21): Symfony\Component\Console\Application->run()
89.03 #8 {main}
------
Dockerfile:23
--------------------
  22 |
  23 | >>> RUN EMBED=dist/app/ \
  24 | >>>     PHP_VERSION=${PHP_VERSION} \
  25 | >>>     FRANKENPHP_VERSION=${FRANKENPHP_VERSION} \
  26 | >>>     PHP_EXTENSIONS=zip,gd,pdo,pdo_mysql,opcache,phar,filter,iconv,openssl,dom \
  27 | >>>     NO_COMPRESS=1 ./build-static.sh
  28 |
--------------------
ERROR: failed to solve: process "/bin/ash -eo pipefail -c EMBED=dist/app/     PHP_VERSION=${PHP_VERSION}     FRANKENPHP_VERSION=${FRANKENPHP_VERSION}     PHP_EXTENSIONS=zip,gd,pdo,pdo_mysql,opcache,phar,filter,iconv,openssl,dom     NO_COMPRESS=1 ./build-static.sh" did not complete successfully: exit code: 1

RishabhBizi avatar Feb 10 '25 10:02 RishabhBizi

Someone actually opened a similar issue #1367.

It would be nice to document a list of extensions Laravel absolutely requires to function (dom seems to just be needed for prettifying console output).

After looking at this static-php-cli tool, I found out that the dom extension actually needs the following libs to properly function: icu,libiconv,libxml2,xz,zlib

This command worked for me, but not everything on here might be necessary:

RUN EMBED=dist/app/ \
    PHP_VERSION=${PHP_VERSION} \
    FRANKENPHP_VERSION=${FRANKENPHP_VERSION} \
    PHP_EXTENSIONS=zip,gd,pdo,pdo_mysql,opcache,phar,filter,iconv,libxml,openssl,dom,simplexml,mbstring,tokenizer,bcmath,ctype \
    PHP_EXTENSION_LIBS=bzip2,libxml2,libiconv,icu,xz,zlib \
    NO_COMPRESS=1 ./build-static.sh

AlliBalliBaba avatar Feb 11 '25 21:02 AlliBalliBaba