Skip to content

Commit c67c3ef

Browse files
committed
Adds postgis image on latest docker image
1 parent 90bb3c6 commit c67c3ef

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

002-create-postgis-extension.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
BEGIN;
2+
CREATE EXTENSION postgis;
3+
CREATE EXTENSION postgis_topology;
4+
CREATE EXTENSION postgis_raster;
5+
CREATE EXTENSION postgis_sfcgal;
6+
CREATE EXTENSION fuzzystrmatch;
7+
CREATE EXTENSION postgis_tiger_geocoder;
8+
9+
10+
11+
-- add Docker flag to node metadata
12+
COMMIT;

postgis/Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file is auto generated from it's template,
2+
# see citusdata/tools/packaging_automation/templates/docker/latest/latest.tmpl.dockerfile.
3+
FROM postgres:14.7
4+
ARG VERSION=10.2.8
5+
ARG POSTGIS_VERSION=3
6+
LABEL maintainer="Citus Data https://citusdata.com" \
7+
org.label-schema.name="Citus" \
8+
org.label-schema.description="Scalable PostgreSQL for multi-tenant and real-time workloads" \
9+
org.label-schema.url="https://www.citusdata.com" \
10+
org.label-schema.vcs-url="https://github.com/citusdata/citus" \
11+
org.label-schema.vendor="Citus Data, Inc." \
12+
org.label-schema.version=${VERSION} \
13+
org.label-schema.schema-version="1.0"
14+
15+
ENV CITUS_VERSION ${VERSION}.citus-1
16+
17+
# install Citus
18+
RUN apt-get update \
19+
&& apt-get install -y --no-install-recommends \
20+
ca-certificates \
21+
curl \
22+
&& curl -s https://install.citusdata.com/community/deb.sh | bash \
23+
&& apt-get install -y postgresql-$PG_MAJOR-citus-10.2=10.2.8.citus-1 \
24+
postgresql-$PG_MAJOR-hll=2.17.citus-1 \
25+
postgresql-$PG_MAJOR-topn=2.5.0.citus-1 \
26+
postgresql-$PG_MAJOR-postgis-${POSTGIS_VERSION} \
27+
&& apt-get purge -y --auto-remove curl \
28+
&& rm -rf /var/lib/apt/lists/*
29+
30+
# add citus to default PostgreSQL config
31+
RUN echo "shared_preload_libraries='citus'" >> /usr/share/postgresql/postgresql.conf.sample
32+
33+
# add scripts to run after initdb
34+
COPY 001-create-citus-extension.sql /docker-entrypoint-initdb.d/
35+
COPY 002-create-postgis-extension.sql /docker-entrypoint-initdb.d/
36+
37+
# add health check script
38+
COPY pg_healthcheck wait-for-manager.sh /
39+
RUN chmod +x /wait-for-manager.sh
40+
41+
# entry point unsets PGPASSWORD, but we need it to connect to workers
42+
# https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303
43+
RUN sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh
44+
45+
HEALTHCHECK --interval=4s --start-period=6s CMD ./pg_healthcheck

0 commit comments

Comments
 (0)