Skip to content

Instantly share code, notes, and snippets.

@maheee
Last active October 7, 2023 09:34
Show Gist options
  • Save maheee/309641ce45a511bc61dd12b1eb10c55e to your computer and use it in GitHub Desktop.
Save maheee/309641ce45a511bc61dd12b1eb10c55e to your computer and use it in GitHub Desktop.
Dockerfile for postgres + timescaledb + timescaledb-toolkit
FROM postgres:15-bullseye
RUN apt update
RUN apt install -y gnupg postgresql-common apt-transport-https lsb-release wget
RUN export YES='yes'; /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
RUN echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | tee /etc/apt/sources.list.d/timescaledb.list
RUN wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /etc/apt/trusted.gpg.d/timescaledb.gpg
RUN apt update
RUN apt install -y timescaledb-2-postgresql-15
RUN apt install -y timescaledb-toolkit-postgresql-15
ENV PGDATA=/var/lib/postgresql/data
VOLUME /var/lib/postgresql/data
COPY ./src/init.sh /docker-entrypoint-initdb.d/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["postgres"]
@maheee
Copy link
Author

maheee commented Oct 7, 2023

init.sh:

#!/bin/sh

timescaledb-tune --quiet --yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment