Skip to content

Instantly share code, notes, and snippets.

@arshpreetsingh
Created March 22, 2019 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arshpreetsingh/386580339bde17d38fa9980a26f84e66 to your computer and use it in GitHub Desktop.
Save arshpreetsingh/386580339bde17d38fa9980a26f84e66 to your computer and use it in GitHub Desktop.
Minimal TimScale
############################
# Build tools binaries in separate image
############################
FROM golang:alpine AS tools
ENV TOOLS_VERSION 0.4.1
RUN apk update && apk add --no-cache git \
&& mkdir -p ${GOPATH}/src/github.com/timescale/ \
&& cd ${GOPATH}/src/github.com/timescale/ \
&& git clone https://github.com/timescale/timescaledb-tune.git \
&& git clone https://github.com/timescale/timescaledb-parallel-copy.git \
# Build timescaledb-tune
&& cd timescaledb-tune/cmd/timescaledb-tune \
&& git fetch && git checkout --quiet $(git describe --abbrev=0) \
&& go get -d -v \
&& go build -o /go/bin/timescaledb-tune
############################
# Now build image and copy in tools
############################
FROM postgres:11-alpine
ARG OSS_ONLY
MAINTAINER Timescale https://www.timescale.com
# Update list above to include previous versions when changing this
ENV TIMESCALEDB_VERSION 1.2.2
COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/
COPY --from=tools /go/bin/* /usr/local/bin/
RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
git \
openssl \
openssl-dev \
tar \
&& mkdir -p /build/ \
&& git clone https://github.com/timescale/timescaledb /build/timescaledb \
\
&& apk add --no-cache --virtual .build-deps \
coreutils \
dpkg-dev dpkg \
gcc \
libc-dev \
make \
cmake \
util-linux-dev \
\
# Build current version \
&& cd /build/timescaledb && rm -fr build \
&& git checkout ${TIMESCALEDB_VERSION} \
&& ./bootstrap -DPROJECT_INSTALL_METHOD="docker"${OSS_ONLY} \
&& cd build && make install \
&& cd ~ \
\
&& apk del .fetch-deps .build-deps \
&& rm -rf /build \
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment