mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-24 00:20:37 +00:00
Make it easy to build only a subset of extensions into compute image (#10655)
The full build of all extensions takes a long time. When working locally on parts that don't need extensions, you can iterate more quickly by skipping the unnecessary extensions. This adds a build argument to the dockerfile to specify extensions to build. There are three options: - EXTENSIONS=all (default) - EXTENSIONS=minimal: Build only a few extensions that are listed in shared_preload_libraries in the default neon config. - EXTENSIONS=none: Build no extensions (except for the mandatory 'neon' extension).
This commit is contained in:
committed by
GitHub
parent
133b89a83d
commit
6699a30a49
@@ -85,6 +85,10 @@ ARG DEBIAN_VERSION=bookworm
|
||||
ARG DEBIAN_FLAVOR=${DEBIAN_VERSION}-slim
|
||||
ARG ALPINE_CURL_VERSION=8.11.1
|
||||
|
||||
# By default, build all PostgreSQL extensions. For quick local testing when you don't
|
||||
# care about the extensions, pass EXTENSIONS=none or EXTENSIONS=minimal
|
||||
ARG EXTENSIONS=all
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# Layer "build-deps"
|
||||
@@ -1484,12 +1488,35 @@ RUN make -j $(getconf _NPROCESSORS_ONLN) \
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# Layer "all-extensions"
|
||||
# Layer "extensions-none"
|
||||
#
|
||||
#########################################################################################
|
||||
FROM build-deps AS extensions-none
|
||||
|
||||
RUN mkdir /usr/local/pgsql
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# Layer "extensions-minimal"
|
||||
#
|
||||
# This subset of extensions includes the extensions that we have in
|
||||
# shared_preload_libraries by default.
|
||||
#
|
||||
#########################################################################################
|
||||
FROM build-deps AS extensions-minimal
|
||||
|
||||
COPY --from=pgrag-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
COPY --from=timescaledb-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
COPY --from=pg_cron-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
COPY --from=pg_partman-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
# Layer "extensions-all"
|
||||
# Bundle together all the extensions
|
||||
#
|
||||
#########################################################################################
|
||||
FROM build-deps AS all-extensions
|
||||
ARG PG_VERSION
|
||||
FROM build-deps AS extensions-all
|
||||
|
||||
# Public extensions
|
||||
COPY --from=postgis-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
@@ -1531,7 +1558,13 @@ COPY --from=pg_partman-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
COPY --from=pg_mooncake-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
COPY --from=pg_repack-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
|
||||
COPY --from=neon-ext-build /usr/local/pgsql/ /usr/local/pgsql/
|
||||
#########################################################################################
|
||||
#
|
||||
# Layer "neon-pg-ext-build"
|
||||
# Includes Postgres and all the extensions chosen by EXTENSIONS arg.
|
||||
#
|
||||
#########################################################################################
|
||||
FROM extensions-${EXTENSIONS} AS neon-pg-ext-build
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
@@ -1614,7 +1647,8 @@ RUN echo -e "--retry-connrefused\n--connect-timeout 15\n--retry 5\n--max-time 30
|
||||
#
|
||||
#########################################################################################
|
||||
FROM neon-ext-build AS postgres-cleanup-layer
|
||||
COPY --from=all-extensions /usr/local/pgsql /usr/local/pgsql
|
||||
|
||||
COPY --from=neon-pg-ext-build /usr/local/pgsql /usr/local/pgsql
|
||||
|
||||
# Remove binaries from /bin/ that we won't use (or would manually copy & install otherwise)
|
||||
RUN cd /usr/local/pgsql/bin && rm -f ecpg raster2pgsql shp2pgsql pgtopo_export pgtopo_import pgsql2shp
|
||||
|
||||
Reference in New Issue
Block a user