-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
118 lines (113 loc) · 4.26 KB
/
Dockerfile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# https://github.com/docker-library/postgres/blob/master/15/alpine3.18/Dockerfile
FROM postgres:15.3-alpine3.18
MAINTAINER Sergei Pikhovkin
LABEL org.opencontainers.image.source=https://github.com/pikhovkin/postgresql-postgis-timescaledb
ENV ALPINE_VERSION v3.18
# https://postgis.net/docs/manual-3.3/postgis_installation.html
ENV POSTGIS_VERSION 3.3.4
ENV POSTGIS_SHA256 68507aa4ab7f9f7218fcefdcdd989911415e5f670128eb33acbbb362a24a998e
RUN set -ex \
\
&& apk add --no-cache --virtual .fetch-deps \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
build-base \
ca-certificates \
openssl \
git \
tar \
&& apk add --no-cache --virtual .build-deps \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
make \
automake \
autoconf \
libtool \
file \
gcc \
g++ \
perl \
clang15 \
clang15-dev \
llvm15 \
llvm15-dev \
libxml2-dev \
\
json-c-dev \
geos-dev \
gdal-dev \
proj-dev \
protobuf-c-dev \
postgresql-dev \
&& apk add --no-cache --virtual .postgis-rundeps \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
json-c \
geos \
gdal \
proj \
protobuf-c \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/postgis \
&& tar --extract --file postgis.tar.gz --directory /usr/src/postgis --strip-components 1 \
&& rm postgis.tar.gz \
\
&& cd /usr/src/postgis \
&& ./autogen.sh \
&& ./configure \
&& make -s \
&& make -s install \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps
# https://docs.timescale.com/self-hosted/latest/install/installation-source/
ENV TIMESCALEDB_VERSION 2.11.1
ENV TIMESCALEDB_SHA256 06a653881dd2460a9c9007dd823be8827ef83fae90a4b628d0b0d5066f60f496
RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
build-base \
ca-certificates \
git \
tar \
&& apk add --no-cache --virtual .build-deps \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
make \
cmake \
gcc \
clang \
clang-dev \
llvm-dev \
dpkg \
dpkg-dev \
util-linux-dev \
libc-dev \
coreutils \
krb5-dev \
&& apk add --no-cache --virtual .timescaledb-rundeps \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/main \
--repository http://dl-cdn.alpinelinux.org/alpine/$ALPINE_VERSION/community \
openssl \
openssl-dev \
\
&& wget -O timescaledb.tar.gz "https://github.com/timescale/timescaledb/archive/$TIMESCALEDB_VERSION.tar.gz" \
&& echo "$TIMESCALEDB_SHA256 *timescaledb.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/timescaledb \
&& tar --extract --file timescaledb.tar.gz --directory /usr/src/timescaledb --strip-components 1 \
&& rm timescaledb.tar.gz \
\
&& cd /usr/src/timescaledb \
&& ./bootstrap -DPROJECT_INSTALL_METHOD="docker" -DREGRESS_CHECKS=OFF \
&& cd ./build && make install \
\
&& cd / \
&& rm -rf /usr/src/timescaledb \
&& apk del .fetch-deps .build-deps \
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample
COPY ./init-postgis.sh /docker-entrypoint-initdb.d/1.postgis.sh
COPY ./init-timescaledb.sh /docker-entrypoint-initdb.d/2.timescaledb.sh
COPY ./init-postgres.sh /docker-entrypoint-initdb.d/3.postgres.sh