forked from Sh1ken/docker-cloudnativepg-timescale
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (34 loc) · 1.63 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (34 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#syntax=docker/dockerfile:1.10
ARG CLOUDNATIVEPG_VERSION
FROM ghcr.io/cloudnative-pg/postgresql:$CLOUDNATIVEPG_VERSION
USER root
ARG POSTGRES_VERSION
ARG TIMESCALE_VERSION
ARG TIMESCALE_TOOLKIT_VERSION
RUN <<EOT
set -eux
# Install dependencies
apt-get update
apt-get install -y --no-install-recommends curl
# Add Timescale apt repo
. /etc/os-release 2>/dev/null
echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $VERSION_CODENAME main" >/etc/apt/sources.list.d/timescaledb.list
curl -Lsf https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor >/etc/apt/trusted.gpg.d/timescale.gpg
# Install Timescale
# Since 2.23.1, Timescale's debian packages append a -<pgMaj><pgMin> suffix
# (e.g. 2.26.3~debian11-1613). Resolve the published version from the repo
# so we match either the plain form or the newest matching suffixed form.
apt-get update
ts_ver=$(apt-cache madison "timescaledb-2-postgresql-$POSTGRES_VERSION" \
| awk -v v="$TIMESCALE_VERSION~debian$VERSION_ID" '$3==v || index($3, v"-")==1 {print $3; exit}')
[ -n "$ts_ver" ] || { echo "no timescaledb-2-postgresql-$POSTGRES_VERSION=$TIMESCALE_VERSION~debian$VERSION_ID* in apt" >&2; exit 1; }
apt-get install -y --no-install-recommends "timescaledb-2-postgresql-$POSTGRES_VERSION=$ts_ver"
# Install Timescale Toolkit
apt-get update
apt-get install -y --no-install-recommends "timescaledb-toolkit-postgresql-$POSTGRES_VERSION=1:$TIMESCALE_TOOLKIT_VERSION~debian$VERSION_ID"
# Cleanup
apt-get purge -y curl
rm /etc/apt/sources.list.d/timescaledb.list /etc/apt/trusted.gpg.d/timescale.gpg
rm -rf /var/cache/apt/*
EOT
USER 26