kopia lustrzana https://github.com/kartoza/docker-postgis
rodzic
a79b312185
commit
fcec79d052
|
@ -16,3 +16,4 @@ LANGS="en_US.UTF-8,id_ID.UTF-8"
|
||||||
POSTGRES_MAJOR_VERSION=14
|
POSTGRES_MAJOR_VERSION=14
|
||||||
POSTGIS_MAJOR_VERSION=3
|
POSTGIS_MAJOR_VERSION=3
|
||||||
POSTGIS_MINOR_RELEASE=2
|
POSTGIS_MINOR_RELEASE=2
|
||||||
|
BUILD_TIMESCALE=true
|
17
Dockerfile
17
Dockerfile
|
@ -12,6 +12,7 @@ LABEL maintainer="Tim Sutton<tim@kartoza.com>"
|
||||||
LABEL cache.invalidation.number="1"
|
LABEL cache.invalidation.number="1"
|
||||||
ARG CACHE_INVALIDATION_NUMBER=1
|
ARG CACHE_INVALIDATION_NUMBER=1
|
||||||
|
|
||||||
|
|
||||||
# Reset ARG for version
|
# Reset ARG for version
|
||||||
ARG IMAGE_VERSION
|
ARG IMAGE_VERSION
|
||||||
|
|
||||||
|
@ -70,7 +71,8 @@ ARG IMAGE_VERSION
|
||||||
ARG POSTGRES_MAJOR_VERSION=14
|
ARG POSTGRES_MAJOR_VERSION=14
|
||||||
ARG POSTGIS_MAJOR_VERSION=3
|
ARG POSTGIS_MAJOR_VERSION=3
|
||||||
ARG POSTGIS_MINOR_RELEASE=2
|
ARG POSTGIS_MINOR_RELEASE=2
|
||||||
ARG TIMESCALE_VERSION=2
|
ARG TIMESCALE_VERSION=2-2.5.0
|
||||||
|
ARG BUILD_TIMESCALE=false
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,8 +81,6 @@ RUN set -eux \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& sh -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main\" > /etc/apt/sources.list.d/pgdg.list" \
|
&& sh -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main\" > /etc/apt/sources.list.d/pgdg.list" \
|
||||||
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add - \
|
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add - \
|
||||||
&& sh -c "echo \"deb [signed-by=/usr/share/keyrings/timescale.keyring] https://packagecloud.io/timescale/timescaledb/debian/ ${IMAGE_VERSION} main\" > /etc/apt/sources.list.d/timescaledb.list" \
|
|
||||||
&& wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /usr/share/keyrings/timescale.keyring \
|
|
||||||
&& apt-get -y --purge autoremove \
|
&& apt-get -y --purge autoremove \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
@ -101,10 +101,17 @@ RUN set -eux \
|
||||||
netcat postgresql-${POSTGRES_MAJOR_VERSION}-ogr-fdw \
|
netcat postgresql-${POSTGRES_MAJOR_VERSION}-ogr-fdw \
|
||||||
postgresql-${POSTGRES_MAJOR_VERSION}-postgis-${POSTGIS_MAJOR_VERSION}-scripts \
|
postgresql-${POSTGRES_MAJOR_VERSION}-postgis-${POSTGIS_MAJOR_VERSION}-scripts \
|
||||||
postgresql-plpython3-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-pgrouting \
|
postgresql-plpython3-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-pgrouting \
|
||||||
postgresql-server-dev-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-cron \
|
postgresql-server-dev-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-cron
|
||||||
timescaledb-${TIMESCALE_VERSION}-postgresql-${POSTGRES_MAJOR_VERSION} timescaledb-tools
|
|
||||||
|
|
||||||
|
|
||||||
|
RUN if [ "${BUILD_TIMESCALE}" =~ [Tt][Rr][Uu][Ee] ]; then \
|
||||||
|
export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
sh -c "echo \"deb [signed-by=/usr/share/keyrings/timescale.keyring] https://packagecloud.io/timescale/timescaledb/debian/ ${IMAGE_VERSION} main\" > /etc/apt/sources.list.d/timescaledb.list" && \
|
||||||
|
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /usr/share/keyrings/timescale.keyring && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get -y --no-install-recommends install timescaledb-${TIMESCALE_VERSION}-postgresql-${POSTGRES_MAJOR_VERSION} timescaledb-tools;\
|
||||||
|
fi;
|
||||||
|
|
||||||
RUN echo $POSTGRES_MAJOR_VERSION >/tmp/pg_version.txt
|
RUN echo $POSTGRES_MAJOR_VERSION >/tmp/pg_version.txt
|
||||||
RUN echo $POSTGIS_MAJOR_VERSION >/tmp/pg_major_version.txt
|
RUN echo $POSTGIS_MAJOR_VERSION >/tmp/pg_major_version.txt
|
||||||
RUN echo $POSTGIS_MINOR_RELEASE >/tmp/pg_minor_version.txt
|
RUN echo $POSTGIS_MINOR_RELEASE >/tmp/pg_minor_version.txt
|
||||||
|
|
|
@ -270,7 +270,8 @@ Some PostgreSQL extensions require shared_preload_libraries to be specified in t
|
||||||
Using the environment variable `SHARED_PRELOAD_LIBRARIES` you can pass comma separated values that correspond to the extensions defined
|
Using the environment variable `SHARED_PRELOAD_LIBRARIES` you can pass comma separated values that correspond to the extensions defined
|
||||||
using the environment variable `POSTGRES_MULTIPLE_EXTENSIONS`.
|
using the environment variable `POSTGRES_MULTIPLE_EXTENSIONS`.
|
||||||
|
|
||||||
The default libraries that are loaded are `pg_cron,timescaledb`
|
The default libraries that are loaded are `pg_cron,timescaledb` if the image is bulilt
|
||||||
|
with timescale support otherwise only `pg_cron` is loaded.
|
||||||
You can pass the env variable
|
You can pass the env variable
|
||||||
```bash
|
```bash
|
||||||
-e SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'
|
-e SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -6,3 +6,5 @@ if [[ ! -f .env ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker-compose -f docker-compose.build.yml build postgis-prod
|
docker-compose -f docker-compose.build.yml build postgis-prod
|
||||||
|
|
||||||
|
#docker-compose -f docker-compose.build-timescale.yml build postgis-prod
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# Used solely for docker-compose build
|
||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
postgis-base:
|
||||||
|
image: kartoza/postgis:base-${DISTRO}-${IMAGE_VERSION}-${IMAGE_VARIANT}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
# Use yaml anchor for reusability
|
||||||
|
args: &build-args-anchor
|
||||||
|
DISTRO: ${DISTRO}
|
||||||
|
IMAGE_VERSION: ${IMAGE_VERSION}
|
||||||
|
IMAGE_VARIANT: ${IMAGE_VARIANT}
|
||||||
|
GENERATE_ALL_LOCALE: ${GENERATE_ALL_LOCALE}
|
||||||
|
POSTGRES_MAJOR_VERSION: ${POSTGRES_MAJOR_VERSION}
|
||||||
|
POSTGIS_MAJOR_VERSION: ${POSTGIS_MAJOR_VERSION}
|
||||||
|
POSTGIS_MINOR_RELEASE: ${POSTGIS_MINOR_RELEASE}
|
||||||
|
BUILD_TIMESCALE: ${BUILD_TIMESCALE}
|
||||||
|
target: postgis-base
|
||||||
|
|
||||||
|
postgis-prod:
|
||||||
|
image: kartoza/postgis:${POSTGRES_MAJOR_VERSION}-${POSTGIS_MAJOR_VERSION}.${POSTGIS_MINOR_RELEASE}-timescale
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
<<: *build-args-anchor
|
||||||
|
target: postgis-prod
|
||||||
|
|
||||||
|
postgis-test:
|
||||||
|
image: kartoza/postgis:manual-build
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
<<: *build-args-anchor
|
||||||
|
target: postgis-test
|
|
@ -217,7 +217,11 @@ if [ -z "${SSL_KEY_FILE}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${POSTGRES_MULTIPLE_EXTENSIONS}" ]; then
|
if [ -z "${POSTGRES_MULTIPLE_EXTENSIONS}" ]; then
|
||||||
|
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]];then
|
||||||
|
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster,pgrouting,timescaledb'
|
||||||
|
else
|
||||||
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster,pgrouting'
|
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster,pgrouting'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -261,7 +265,11 @@ if [ -z "$EXTRA_CONF" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${SHARED_PRELOAD_LIBRARIES}" ]; then
|
if [ -z "${SHARED_PRELOAD_LIBRARIES}" ]; then
|
||||||
|
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]];then
|
||||||
SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'
|
SHARED_PRELOAD_LIBRARIES='pg_cron,timescaledb'
|
||||||
|
else
|
||||||
|
SHARED_PRELOAD_LIBRARIES='pg_cron'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$PASSWORD_AUTHENTICATION" ]; then
|
if [ -z "$PASSWORD_AUTHENTICATION" ]; then
|
||||||
|
|
|
@ -93,7 +93,7 @@ fi
|
||||||
|
|
||||||
# Timescale default tuning
|
# Timescale default tuning
|
||||||
# TODO If timescale DB accepts reading from include directory then refactor code to remove line 97 - 112 (https://github.com/timescale/timescaledb-tune/issues/80)
|
# TODO If timescale DB accepts reading from include directory then refactor code to remove line 97 - 112 (https://github.com/timescale/timescaledb-tune/issues/80)
|
||||||
if [[ ${ACCEPT_TIMESCALE_TUNING} =~ [Tt][Rr][Uu][Ee] ]];then
|
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]] && [[ ${ACCEPT_TIMESCALE_TUNING} =~ [Tt][Rr][Uu][Ee] ]] ;then
|
||||||
if [[ -f ${ROOT_CONF}/postgis.conf ]];then
|
if [[ -f ${ROOT_CONF}/postgis.conf ]];then
|
||||||
sed -i '/postgis.conf/d' "${ROOT_CONF}"/postgresql.conf
|
sed -i '/postgis.conf/d' "${ROOT_CONF}"/postgresql.conf
|
||||||
cat "${ROOT_CONF}"/postgis.conf >> "${ROOT_CONF}"/postgresql.conf
|
cat "${ROOT_CONF}"/postgis.conf >> "${ROOT_CONF}"/postgresql.conf
|
||||||
|
|
Ładowanie…
Reference in New Issue