fly-apps / laravel-docker

Base Docker images for use with Laravel on Fly.io
44 stars 9 forks source link

How to add missing PHP extensions? #13

Open simonhamp opened 5 months ago

simonhamp commented 5 months ago

I have a Composer dependency that requires imagick, but it seems it's not included here. How can I add it?

KTanAug21 commented 5 months ago

Hello @simonhamp!

1️⃣ If you want to locally build an image from this repository and include an additional package in that image, you can include the package in the list of packages installed from the Dockerfile template, in this line here. As you can see this line installs packages listed in a custom file, which is selected based on the current PHP_VERSION. These files are available in the php/packages/ folder.

2️⃣ On the other hand, if you'll be extending the image built from this repository, found in dockerhub. Then you can simply add another RUN command to install the extension, likeso:

ARG PHP_VERSION=8.2
ARG NODE_VERSION=18
FROM fideloper/fly-laravel:${PHP_VERSION} as base

ARG PHP_VERSION

# Include the new package
+ RUN apt-get update; \
+    apt-get install -y imagemagick php${PHP_VERSION}-imagick;