Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"permissions": {
"allow": [
"Bash(chmod:*)"
],
"deny": [],
"ask": []
}
}
40 changes: 40 additions & 0 deletions 17extra/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM dockette/postgres:17

# Install build dependencies and extension packages
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
postgresql-server-dev-${POSTGRES_VERSION} \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Install pgvector
RUN git clone --branch v0.7.2 https://github.com/pgvector/pgvector.git /tmp/pgvector \
&& cd /tmp/pgvector \
&& make \
&& make install \
&& rm -rf /tmp/pgvector

# Install pg_cron
RUN git clone --branch v1.7.1 https://github.com/citusdata/pg_cron.git /tmp/pg_cron \
&& cd /tmp/pg_cron \
&& make \
&& make install \
&& rm -rf /tmp/pg_cron

# Install TimescaleDB
RUN curl -s https://packagecloud.io/install/repositories/timescale/timescaledb/script.deb.sh | bash \
&& apt-get update \
&& apt-get install -y --no-install-recommends timescaledb-2-postgresql-${POSTGRES_VERSION} \
&& rm -rf /var/lib/apt/lists/*

# Copy extension init scripts
COPY ./17extra/init-scripts/* /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/*.sh

# Clean up build dependencies (optional, keeps image smaller)
RUN apt-get purge -y build-essential git \
&& apt-get autoremove -y \
&& apt-get clean

15 changes: 15 additions & 0 deletions 17extra/init-scripts/005-timescaledb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create extension in template1 and $POSTGRES_DB
for DB in template1 "$POSTGRES_DB"; do
echo "Creating extension timescaledb into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS timescaledb;
EOSQL
done

15 changes: 15 additions & 0 deletions 17extra/init-scripts/006-pg_cron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create extension in template1 and $POSTGRES_DB
for DB in template1 "$POSTGRES_DB"; do
echo "Creating extension pg_cron into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS pg_cron;
EOSQL
done

15 changes: 15 additions & 0 deletions 17extra/init-scripts/007-pgvector.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -e

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create extension in template1 and $POSTGRES_DB
for DB in template1 "$POSTGRES_DB"; do
echo "Creating extension vector into $DB"
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
done

22 changes: 22 additions & 0 deletions 17pig/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM postgres:17

ENV POSTGRES_VERSION=17

# Install pig extension package manager
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& curl -fsSL https://repo.pigsty.io/pig | bash \
&& rm -rf /var/lib/apt/lists/*

# Set up repositories and install extensions using pig
RUN pig repo set && \
pig install -y -v ${POSTGRES_VERSION} timescaledb pg_cron pgvector

# Preload required libraries (timescaledb and pg_cron require this)
RUN echo "shared_preload_libraries = 'timescaledb,pg_cron'" >> /usr/share/postgresql/postgresql.conf.sample

# Copy extension init scripts
COPY ./17pig/init-scripts/* /docker-entrypoint-initdb.d/
RUN chmod +x /docker-entrypoint-initdb.d/*.sh

20 changes: 20 additions & 0 deletions 17pig/init-scripts/001-extensions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Exit on subcommand errors
set -Eeuo pipefail

# Perform all actions as $POSTGRES_USER
export PGUSER="$POSTGRES_USER"

# Create extensions in template1 and $POSTGRES_DB
for DB in template1 "$POSTGRES_DB"; do
echo "Creating extensions in $DB"
psql -d "$DB" <<-'EOSQL'
CREATE EXTENSION IF NOT EXISTS timescaledb;
CREATE EXTENSION IF NOT EXISTS vector;
EOSQL
done

# pg_cron can only be installed in the postgres database
echo "Creating extension pg_cron in postgres"
psql -d postgres -c "CREATE EXTENSION IF NOT EXISTS pg_cron;"
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ build-15: _build-15
build-16: _build-16
build-17: _build-17
build-17extra: _build-17extra
build-17pig: _build-17pig
build-18: _build-18

_build-%: BUILD_VERSION=$*
Expand All @@ -15,3 +16,15 @@ _build-%:
-t dockette/postgres:${BUILD_VERSION} \
-f ${BUILD_VERSION}/Dockerfile \
.

_build-17extra:
docker build \
-t dockette/postgres:17extra \
-f 17extra/Dockerfile \
.

_build-17pig:
docker build \
-t dockette/postgres:17pig \
-f 17pig/Dockerfile \
.
2 changes: 1 addition & 1 deletion shared/init-scripts/002-intarray.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -e

Expand Down
2 changes: 1 addition & 1 deletion shared/init-scripts/003-unaccent.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -e

Expand Down