diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 0000000..b8b3b2e --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,74 @@ +ARG PG_TAG +ARG TS_VERSION +############################ +# Build tools binaries in separate image +############################ +ARG GO_VERSION=1.19.1 +FROM golang:${GO_VERSION}-alpine AS tools + +ARG TIMESCALEDB_TUNE_VERSION=v0.14.2 +ARG TIMESCALEDB_PARALLELCOPY_VERSION=v0.4.0 + +ENV TOOLS_VERSION 0.8.1 + +RUN apk update && apk add --no-cache git gcc \ + && go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@${TIMESCALEDB_TUNE_VERSION} \ + && go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@${TIMESCALEDB_PARALLELCOPY_VERSION} + + +ARG PG_TAG +FROM postgres:${PG_TAG} +ARG OSS_ONLY + +LABEL maintainer="Timescale https://www.timescale.com" + +COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ +COPY --from=tools /go/bin/* /usr/local/bin/ + +ARG TS_VERSION +RUN set -ex \ + && mkdir -p /var/lib/apt/lists/partial \ + && apt-get update \ + && apt-get -y install \ + \ + build-essential \ + libssl-dev \ + git \ + \ + dpkg-dev \ + gcc \ + libc-dev \ + make \ + cmake \ + wget \ + libkrb5-dev \ + postgresql-server-dev-${PG_MAJOR} \ + && mkdir -p /build/ \ + && git clone https://github.com/timescale/timescaledb /build/timescaledb \ + \ + # Build current version \ + && cd /build/timescaledb && rm -fr build \ + && git checkout ${TS_VERSION} \ + && ./bootstrap -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF -DGENERATE_DOWNGRADE_SCRIPT=ON -DWARNINGS_AS_ERRORS=OFF -DPROJECT_INSTALL_METHOD="docker"${OSS_ONLY} \ + && cd build && make install \ + && cd ~ \ + \ + && apt-get autoremove --purge -y \ + \ + build-essential \ + libssl-dev \ + \ + dpkg-dev \ + gcc \ + libc-dev \ + make \ + cmake \ + libkrb5-dev \ + && apt-get clean -y \ + && rm -rf \ + "${HOME}/.cache" \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* \ + /build \ + && sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/share/postgresql/postgresql.conf.sample \ No newline at end of file diff --git a/README.md b/README.md index bdf788e..a19bb4b 100644 --- a/README.md +++ b/README.md @@ -73,3 +73,12 @@ To not run `timescaledb-tune` at all, use the `NO_TS_TUNE` environment variable: ``` $ docker run -d --name timescaledb -p 5432:5432 -e POSTGRES_PASSWORD=password -e NO_TS_TUNE=true timescale/timescaledb:latest-pg13 ``` + +### About Debian based timescaledb image +Docker.debian file can be used to create a Debian based timescaledb image. +Created images will be based on official debian based postgresql images. + +For an image based on PG 13.9-bullesye image: +``` +docker build -t timescaledb:2.8.1-pg13-bullseye --build-arg PG_TAG=13.9-bullseye --build-arg TS_VERSION=2.8.1 -f Dockerfile.debian . +``` \ No newline at end of file