Skip to content

Purge build deps to shrink the 12.15 image from 2.47 GB to 1.76 GB #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ ENV PGTAP_VERSION 1.2.0
ENV PARTMAN_VERSION 4.7.2

USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
clang \
RUN BUILD_DEPS="clang \
dirmngr \
gnupg \
gosu \
libclang-dev \
libicu-dev \
libipc-run-perl \
Expand All @@ -40,11 +38,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libxslt1-dev \
llvm \
llvm-dev \
locales \
postgresql-server-dev-all \
python3-dev \
tcl-dev \
uuid-dev \
uuid-dev" && \
apt-get update && apt-get install -y --no-install-recommends \
gosu \
locales \
$BUILD_DEPS \
&& \
rm -rf /var/lib/apt/lists/* && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
Expand Down Expand Up @@ -78,18 +79,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# we can change from world to world-bin in newer releases
make world && \
make install-world && \
cd .. && rm -rf postgresql-${PG_VER}
cd .. && rm -rf postgresql-${PG_VER} \
&& \
git clone --depth 1 https://github.com/citusdata/pg_cron.git /pg_cron && \
cd /pg_cron && make && PATH=$PATH make install && \
rm -rf /pg_cron && \
apt-get purge -y --auto-remove $BUILD_DEPS

RUN curl -sSL "https://github.com/pgpartman/pg_partman/archive/v${PARTMAN_VERSION}.tar.gz" | tar -xz && \
cd pg_partman-${PARTMAN_VERSION} && make NO_BGW=1 install && \
cd .. && rm -rf pg_partman-${PARTMAN_VERSION}

# clones pg_cron extension for local use, this is not available wihout installing
# run this as a separate layer so it caches better
RUN git clone --depth 1 https://github.com/citusdata/pg_cron.git /pg_cron && \
cd /pg_cron && make && PATH=$PATH make install && \
rm -rf /pg_cron

# Install pgTAP & pg_prove utility.
RUN git clone --depth 1 -b "v$PGTAP_VERSION" https://github.com/theory/pgtap.git /pgtap && \
cd /pgtap && make && make install && \
Expand Down