docker-library / php

Docker Official Image packaging for PHP
https://php.net
MIT License
3.84k stars 2.01k forks source link

Error during build prod.Dockerfile #1490

Closed BraianPita closed 9 months ago

BraianPita commented 9 months ago

I am trying Docking for the first time, and I went through the process of installing it through building since I could not get pass the password section when trying the dev docker image.

I was getting the following error during docker build:

10.34 checking for PHP extension directory... /usr/local/lib/php/extensions/no-debug-non-zts-20220829
10.34 checking for PHP installed headers prefix... /usr/local/include/php
10.34 checking if debug is enabled... no
10.36 checking if zts is enabled... no
10.37 checking for gawk... no
10.37 checking for nawk... nawk
10.37 checking if nawk is broken... no
10.37 checking for PostgreSQL support for PDO... yes, shared
10.37 checking for pg_config... not found
10.37 configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
------
prod.Dockerfile:26
--------------------
  24 |
  25 |     # Install PHP extensions
  26 | >>> RUN docker-php-ext-install pdo pdo_pgsql pdo_mysql mbstring exif pcntl bcmath gd
  27 |
  28 |     # Copy project files
--------------------
ERROR: failed to solve: process "/bin/sh -c docker-php-ext-install pdo pdo_pgsql pdo_mysql mbstring exif pcntl bcmath gd" did not complete successfully: exit code: 1

I used the following as reference: https://github.com/docker-library/php/issues/221

and added the following to the prod.Dockerfile

# Install Postgre PDO
RUN apt-get install -y libpq-dev \
    && docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
    && docker-php-ext-install pdo pdo_pgsql pgsql

And it was able to build the image successfully. But I am now getting the following:

image