Skip to content

Commit

Permalink
Delete postgresql-dev to reduce docker layer size
Browse files Browse the repository at this point in the history
The postgresql-dev is only needed during installation so it can be deleted
after the extension is installed.
  • Loading branch information
stnguyen90 committed Sep 13, 2023
1 parent 3f6e6df commit 0570481
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ COPY composer.json /usr/local/src/
RUN composer install --ignore-platform-reqs

FROM php:8.1.21-fpm-alpine3.18 as tests
RUN set -ex && apk --no-cache add postgresql-dev
RUN docker-php-ext-install pdo pdo_pgsql
# Postgres
RUN set -ex \
&& apk --no-cache add postgresql-libs postgresql-dev \
&& docker-php-ext-install pdo pdo_pgsql \
&& apk del postgresql-dev
COPY ./src /app/src
COPY ./tests /app/src/tests
COPY --from=composer /usr/local/src/vendor /app/vendor
Expand Down

0 comments on commit 0570481

Please sign in to comment.