Skip to content

Commit

Permalink
Refactor PostgreSQL setup in PHP Dockerfiles
Browse files Browse the repository at this point in the history
Simplified PostgreSQL integration by replacing manual setup with copying `pg_dump` from the official Postgres image. Removed redundant `pgsql` and `pdo_pgsql` extensions since they are included in the image.
  • Loading branch information
hrsa committed Feb 1, 2025
1 parent cc4433a commit 3d3db3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions docker/php-prod.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,9 @@ RUN apt-get update && apt-get install -y \
locales \
gnupg

RUN install-php-extensions intl exif bcmath bz2 gd

RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg && \
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt $(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && apt-get install -y postgresql-common

RUN install-php-extensions intl exif bcmath bz2 gd pgsql pdo_pgsql
COPY --from=postgres:17.2 /usr/bin/pg_dump /usr/local/bin/pg_dump


RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash -
Expand Down
6 changes: 2 additions & 4 deletions docker/php.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ RUN apt-get update && apt-get install -y \
locales \
gnupg

RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/keyrings/postgresql.gpg && \
echo "deb [signed-by=/usr/share/keyrings/postgresql.gpg] http://apt.postgresql.org/pub/repos/apt $(grep VERSION_CODENAME /etc/os-release | cut -d= -f2)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
apt-get update && apt-get install -y postgresql-common
RUN install-php-extensions intl exif bcmath bz2 gd

RUN install-php-extensions intl exif bcmath bz2 gd pgsql pdo_pgsql
COPY --from=postgres:17.2 /usr/bin/pg_dump /usr/local/bin/pg_dump

RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash -
RUN apt-get install -y nodejs
Expand Down

0 comments on commit 3d3db3b

Please sign in to comment.