bashman's avatar

Error building static frankenphp for Laravel

I have this dockerfile:

FROM --platform=linux/amd64 dunglas/frankenphp:static-builder as builder
WORKDIR /go/src/app/dist/app
COPY . .
RUN composer install --ignore-platform-reqs --no-dev -a
WORKDIR /go/src/app
RUN EMBED=dist/app/ \
PHP_EXTENSIONS=ctype,curl,tokenizer,session,fileinfo,dom,mbstring,posix,pcntl,intl,iconv,readline,pdo_sqlite,gd,zip,curl,redis,bcmath,gettext,xml,openssl,pdo_pgsql,pgsql,xsl,xmlwriter \
./build-static.sh
FROM alpine:3.19.0
WORKDIR /app
COPY --from=builder /go/src/app/dist/frankenphp-linux-x86_64 project
EXPOSE 80/tcp
CMD ["./project", "php-server"]

Then

	docker build -t project .

I got this error:

1.803 > Illuminate\Foundation\ComposerScripts::postAutoloadDump
1.813 > @php artisan package:discover --ansi
2.390 
2.396 In HtmlRenderer.php line 32:
2.396                                  
2.396   Class "DOMDocument" not found  
2.396                                  
2.396 
2.402 Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
------
Dockerfile:4
--------------------
   2 |     WORKDIR /go/src/app/dist/app
   3 |     COPY . .
   4 | >>> RUN composer install --ignore-platform-reqs --no-dev -a
   5 |     WORKDIR /go/src/app
   6 |     RUN EMBED=dist/app/ \
--------------------
ERROR: failed to solve: process "/bin/ash -eo pipefail -c composer install --ignore-platform-reqs --no-dev -a" did not complete successfully: exit code: 1

Some guidance for fix it issue?.

0 likes
0 replies

Please or to participate in this conversation.