Skip to content

Commit

Permalink
Add NOAI
Browse files Browse the repository at this point in the history
if NOAI=true, skip installing AI-related packages/extensions since
they are quite large.
  • Loading branch information
graveland committed Feb 5, 2025
1 parent 875d9c9 commit 84bb169
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
PG_MAJOR: 17
ALL_VERSIONS: "true"
SLIM: "true"
NOAI: "true"
OSS_ONLY: "false"

jobs:
Expand Down
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ SHELL ["/bin/bash", "-eu", "-o", "pipefail", "-c"]
ARG PG_VERSIONS="17 16 15 14 13"
ARG PG_MAJOR=17

ARG NOAI=false
ARG SLIM=false

ENV DEBIAN_FRONTEND=noninteractive

# We install some build dependencies and mark the installed packages as auto-installed,
Expand Down Expand Up @@ -204,7 +207,8 @@ RUN <<EOT
postgresql-${pg}-pg-stat-kcache postgresql-${pg}-cron postgresql-${pg}-pldebugger postgresql-${pg}-pgpcre \
postgresql-${pg}-pglogical postgresql-${pg}-wal2json postgresql-${pg}-pgq3 postgresql-${pg}-pg-qualstats \
postgresql-${pg}-pgaudit postgresql-${pg}-ip4r postgresql-${pg}-pgtap postgresql-${pg}-orafce \
postgresql-${pg}-pgvector postgresql-${pg}-h3 postgresql-${pg}-rum"; \
postgresql-${pg}-h3 postgresql-${pg}-rum"; \
[ "$NOAI" = true ] && packages="$packages postgresql-${pg}-pgvector"
done; \
apt-get install -y $packages
EOT
Expand Down Expand Up @@ -414,10 +418,14 @@ RUN OSS_ONLY="${OSS_ONLY}" \
/build/scripts/install_extensions rust

ARG PGVECTORSCALE_VERSIONS
RUN OSS_ONLY="${OSS_ONLY}" \
RUST_RELEASE="${RUST_RELEASE}" \
PGVECTORSCALE_VERSIONS="${PGVECTORSCALE_VERSIONS}" \
/build/scripts/install_extensions pgvectorscale
RUN <<EOT
if [ -n "$PGVECTORSCALE_VERSIONS" ]; then
OSS_ONLY="${OSS_ONLY}" \
RUST_RELEASE="${RUST_RELEASE}" \
PGVECTORSCALE_VERSIONS="${PGVECTORSCALE_VERSIONS}" \
/build/scripts/install_extensions pgvectorscale
fi
EOT

USER root

Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ all: help
# SLIM=true changes a bit about what we build, removing some larger things
SLIM ?= false

# NOAI doesn't include the ai packages since they are quite large
NOAI ?= false

PG_MAJOR?=17
# All PG_VERSIONS binaries/libraries will be included in the Dockerfile
# specifying multiple versions will allow things like pg_upgrade etc to work.
Expand Down Expand Up @@ -42,6 +45,12 @@ else
PGBACKREST_EXPORTER_VERSION?=0.18.0
endif

ifeq ($(NOAI),true)
PGAI_VERSIONS=
PGVECTORSCALE_VERSIONS=
PGVECTO_RS=
endif

# This is used to build the docker --platform, so pick amd64 or arm64
PLATFORM?=amd64

Expand Down Expand Up @@ -83,6 +92,10 @@ ifeq ($(SLIM),true)
PG_VERSIONS := 17 16
endif

ifeq ($(NOAI),true)
DOCKER_TAG_POSTFIX := $(strip $(DOCKER_TAG_POSTFIX))-noai
endif

ifeq ($(OSS_ONLY),true)
DOCKER_TAG_POSTFIX := $(strip $(DOCKER_TAG_POSTFIX))-oss
endif
Expand Down Expand Up @@ -167,6 +180,7 @@ DOCKER_BUILD_COMMAND=docker build \
--pull \
--progress=plain \
--build-arg SLIM="$(SLIM)" \
--build-arg NOAI="$(NOAI)" \
--build-arg DOCKER_FROM="$(DOCKER_FROM)" \
--build-arg ALLOW_ADDING_EXTENSIONS="$(ALLOW_ADDING_EXTENSIONS)" \
--build-arg GITHUB_DOCKERLIB_POSTGRES_REF="$(GITHUB_DOCKERLIB_POSTGRES_REF)" \
Expand Down

0 comments on commit 84bb169

Please sign in to comment.