Skip to content

Instantly share code, notes, and snippets.

@MartinHeinz
Created August 15, 2023 09:43
Show Gist options
  • Save MartinHeinz/2ea26ad81a5984de6befdacf855a9255 to your computer and use it in GitHub Desktop.
Save MartinHeinz/2ea26ad81a5984de6befdacf855a9255 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Remove last line "shared_preload_libraries='citus'"
sed -i '$ d' ${PGDATA}/postgresql.conf
cat <<EOT >> ${PGDATA}/postgresql.conf
shared_preload_libraries='pg_cron'
cron.database_name='${POSTGRES_DB:-postgres}'
EOT
# Required to load pg_cron
pg_ctl restart
CREATE EXTENSION pg_cron;
FROM postgres:15.3-bullseye
RUN apt-get update && apt install -y curl ca-certificates gnupg | curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
RUN apt-get -y install postgresql-15-cron
COPY 002-setup.sh 003-main.sql /docker-entrypoint-initdb.d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment