brefphp / bref

Serverless PHP on AWS Lambda
https://bref.sh
MIT License
3.15k stars 365 forks source link

Unable to load dynamic library '/opt/bref-extra/gd.so' #1458

Closed rodrigopaggue closed 1 year ago

rodrigopaggue commented 1 year ago

Description:

I am getting the following error in my application

How to reproduce:

Basically I have these commands in my docker file:

FROM bref/php-81-fpm:1.7.18 as handler

COPY --from=bref/extra-redis-php-81 /opt/bref-extra/ /opt/bref-extra
COPY --from=bref/extra-redis-php-81 /opt/bref/ /opt/bref
COPY --from=bref/extra-gmp-php-81 /opt/bref-extra/ /opt/bref-extra
COPY --from=bref/extra-gmp-php-81 /opt/bref/ /opt/bref
COPY --from=bref/extra-gd-php-81:0.12.0 /opt/bref-extra/ /opt/bref-extra
COPY --from=bref/extra-gd-php-81:0.12.0 /opt/bref/ /opt/bref

COPY --from=builder /var/task .
micaelzz commented 1 year ago

same here

mnapoli commented 1 year ago

I cannot reproduce.

FROM bref/php-81-fpm:1.7.18 as handler

COPY --from=bref/extra-gd-php-81:0.12.0 /opt/bref-extra/ /opt/bref-extra
COPY --from=bref/extra-gd-php-81:0.12.0 /opt/bref/ /opt/bref

After building that container, I can run it successfully and gd_info() returns correct information.

Are you sure your FROM bref/php-81-fpm:1.7.18 contains a Bref version? It sounds like your Dockerfile upgraded to using Bref v2.0 images.

anggras commented 1 year ago

There are some changes in the bref/extra-gd-php-81 image from version 1.0

COPY /tmp/gd.so /opt/bref/extensions/gd.so # buildkit
COPY /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-gd.ini # buildkit
COPY /tmp/extension-libs /opt/lib # buildkit

so most likely you'll need to either to lock the version to 0.12.4 or use this instead:

COPY --from=bref/extra-gd-php-81:1.0 /opt/bref/ /opt/bref
COPY --from=bref/extra-gd-php-81:1.0 /opt/lib/ /opt/lib
mnapoli commented 1 year ago

You should do:

COPY --from=bref/extra-gd-php-81:1 /opt /opt

@anggras what do you mean? What problems are you seeing.

anggras commented 1 year ago

@mnapoli had similar problem described in this issue as I think we were following the example in here. Realised that there are some file location changes with bref/extra-gd-php-81 from 0.x to 1.x. Plus, I didn't pin down the bref/extra-gd-php-81 version while still using Bref 1.x in my Dockerfile.

All is good now.