cwbit / cakephp-docker

A Docker Compose setup for CakePHP Applications
MIT License
85 stars 40 forks source link

I have problem installing GD, so that composer would see it #7

Closed MarekSz88 closed 3 months ago

MarekSz88 commented 4 months ago

Tried chatgpt to help but it took me nowhere

Problem 1

I always start to hate docker when simple things like "php8.1-gd \" are not solving anything.

Besides cool repo, setup docker in 60 seconds :)

cwbit commented 3 months ago

Thanks!! Here's the fix --> Add the following line to your php-fpm / Dockerfile right after the other install commands

php8.1-gd \

For example if you're using the default shipped with this repo, your new dockerfile will look like this

FROM phpdockerio/php:8.1-fpm
WORKDIR "/var/www/myapp"

# Install selected extensions and other stuff
RUN apt-get update \
    && apt-get -y --no-install-recommends install \
        php8.1-intl \
        php8.1-mysql \
        php8.1-sqlite3 \
        php8.1-gd \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

To figure out how to add others in the future, use https://phpdocker.io, find the extensions you want, have it generate the files, and then add the lines it generates into your php-fpm/Docker file

MarekSz88 commented 3 months ago

... ok ... figured it out... or just luck not sure. removing images etc. was not helping but calling docker compose build --no-cache, for tenth time finally loaded GD :D

----before edit on top Yea, that's what I tried, yet still when I run composer update I get

also in phpinfo() no mention of GD

=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 451B 0.0s => [internal] load metadata for docker.io/phpdockerio/php:8.1-fpm 2.2s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/phpdockerio/php:8.1-fpm@sha256:a498010d71e7b5e10e568b216b1f6a5dc3b0d64024e92ff9fd44e9f91933c860 2.1s => => resolve docker.io/phpdockerio/php:8.1-fpm@sha256:a498010d71e7b5e10e568b216b1f6a5dc3b0d64024e92ff9fd44e9f91933c860 0.0s => => sha256:e542fd8906a23d950e3101369c8ee82c2b6a6f2a107a9000d268206ed2011165 1.25kB / 1.25kB 0.0s => => sha256:225f505f98fb33acec9cc14e837038dfba70880088adfc555948f69089aab72b 3.96kB / 3.96kB 0.0s => => sha256:f23123b51a4416f1e98263df3b6dcc3579cff7eefcee83614f44ff7bd5d5b414 27.83MB / 27.83MB 1.2s => => sha256:9fadf01a7b6840f096ae09d3db917d20966ddbb74ead93a97487ae8f6380a05a 726.31kB / 726.31kB 0.6s => => sha256:b644cb47cad2266a0b62d3c044bc6af1cde0a6372fa7c58c700dec694fb2bb2d 8.08MB / 8.08MB 1.3s => => sha256:a498010d71e7b5e10e568b216b1f6a5dc3b0d64024e92ff9fd44e9f91933c860 2.38kB / 2.38kB 0.0s => => sha256:913442d4b629cd51e1b19b79e0a05f286dd1484a0963b628e35056fc29b30f2b 685B / 685B 1.0s => => extracting sha256:f23123b51a4416f1e98263df3b6dcc3579cff7eefcee83614f44ff7bd5d5b414 0.6s => => extracting sha256:9fadf01a7b6840f096ae09d3db917d20966ddbb74ead93a97487ae8f6380a05a 0.0s => => extracting sha256:b644cb47cad2266a0b62d3c044bc6af1cde0a6372fa7c58c700dec694fb2bb2d 0.2s => => extracting sha256:913442d4b629cd51e1b19b79e0a05f286dd1484a0963b628e35056fc29b30f2b 0.0s => [2/3] WORKDIR /var/www/myapp 0.1s => [3/3] RUN apt-get update && apt-get -y --no-install-recommends install php8.1-gd php8.1-intl php8.1-mysql php8.1-sqlite3 && apt-get clean && rm -rf /var/lib/a 26.3s => exporting to image 0.1s => => exporting layers 0.1s => => writing image sha256:76a4dbe948995a91d7ff4fcee19c4e48b671904fa1edd87b226dd75a6201532b