docker-postgis/Dockerfile

244 wiersze
9.2 KiB
Docker

2021-01-27 18:06:59 +00:00
##############################################################################
# Base stage #
##############################################################################
ARG DISTRO=debian
2023-07-29 13:07:11 +00:00
ARG IMAGE_VERSION=bookworm
ARG IMAGE_VARIANT=slim
2021-01-27 18:06:59 +00:00
FROM $DISTRO:$IMAGE_VERSION-$IMAGE_VARIANT AS postgis-base
2021-01-30 00:13:10 +00:00
LABEL maintainer="Tim Sutton<tim@kartoza.com>"
# Cache invalidation number is used to invalidate a cache.
# Simply increment the number by 1 to reset the cache in local and GitHub Action
# This is added because we can't purge GitHub Action cache manually
LABEL cache.invalidation.number="1"
ARG CACHE_INVALIDATION_NUMBER=1
2021-01-27 18:06:59 +00:00
2021-01-27 18:06:59 +00:00
# Reset ARG for version
ARG IMAGE_VERSION
RUN apt-get -qq update --fix-missing && apt-get -qq --yes upgrade
RUN set -eux \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
2024-09-26 08:36:33 +00:00
&& apt-get -y --no-install-recommends install \
2024-09-26 12:01:05 +00:00
locales gnupg2 wget ca-certificates rpl pwgen software-properties-common iputils-ping \
2024-09-26 09:32:30 +00:00
apt-transport-https curl gettext pgxnclient cmake && \
2024-09-26 12:01:05 +00:00
apt-get -y install build-essential autoconf libxml2-dev zlib1g-dev netcat-openbsd gdal-bin \
2024-09-26 09:32:30 +00:00
figlet toilet gosu; \
# verify that the binary works
2024-09-26 12:01:05 +00:00
gosu nobody true && \
2024-09-26 09:32:30 +00:00
dpkg-divert --local --rename --add /sbin/initctl
2021-01-27 18:06:59 +00:00
2024-09-26 12:01:05 +00:00
# Generating locales takes a long time. Utilize caching by runnig it by itself
2021-01-27 18:06:59 +00:00
# early in the build process.
# Generate all locale only on deployment mode build
# Set to empty string to generate only default locale
ARG GENERATE_ALL_LOCALE=1
2021-01-27 18:59:12 +00:00
ARG LANGS="en_US.UTF-8,id_ID.UTF-8"
2021-01-27 18:06:59 +00:00
ARG LANG=en_US.UTF-8
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8
2021-11-28 05:38:57 +00:00
COPY ./base_build/scripts/locale.gen /etc/all.locale.gen
COPY ./base_build/scripts/locale-filter.sh /etc/locale-filter.sh
2021-01-27 18:06:59 +00:00
RUN if [ -z "${GENERATE_ALL_LOCALE}" ] || [ $GENERATE_ALL_LOCALE -eq 0 ]; \
2024-09-26 12:01:05 +00:00
then \
cat /etc/all.locale.gen | grep "${LANG}" > /etc/locale.gen; \
/bin/bash /etc/locale-filter.sh; \
else \
cp -f /etc/all.locale.gen /etc/locale.gen; \
fi; \
set -eux \
&& /usr/sbin/locale-gen
2021-01-27 18:06:59 +00:00
RUN update-locale ${LANG}
2021-01-27 18:06:59 +00:00
# Cleanup resources
2024-09-26 12:01:05 +00:00
RUN apt-get -y --purge autoremove \
2021-01-27 18:06:59 +00:00
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
##############################################################################
# Production Stage #
##############################################################################
FROM postgis-base AS postgis-prod
2014-05-04 19:14:46 +00:00
# Reset ARG for version
ARG IMAGE_VERSION
2023-10-08 15:31:55 +00:00
ARG POSTGRES_MAJOR_VERSION=16
2021-01-27 18:06:59 +00:00
ARG POSTGIS_MAJOR_VERSION=3
2023-08-19 18:22:21 +00:00
ARG POSTGIS_MINOR_RELEASE=4
2024-09-26 12:01:05 +00:00
# https://packagecloud.io/timescale/timescaledb
2024-09-26 16:23:02 +00:00
ARG TIMESCALE_VERSION=2
ARG BUILD_TIMESCALE=true
2024-09-26 12:56:00 +00:00
RUN set -eux \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
2024-09-26 12:01:05 +00:00
&& wget -O- https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sh -c 'cat > /usr/share/keyrings/postgresql.gpg' > /dev/null \
&& echo deb [signed-by=/usr/share/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main | tee /etc/apt/sources.list.d/pgdg.list 2>/dev/null \
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& dpkg-divert --local --rename --add /sbin/initctl
2024-09-26 12:01:05 +00:00
2014-05-04 19:14:46 +00:00
#-------------Application Specific Stuff ----------------------------------------------------
2024-09-26 15:08:44 +00:00
# Use an alternative method to add pgBackRest repository and key
# If the key fails, try skipping key verification for now
RUN apt-get update
RUN apt-get install -y cron
RUN wget -qO- https://pgbackrest.org/pgbackrest.gpg | tee /etc/apt/trusted.gpg.d/pgbackrest.gpg && \
echo "deb http://apt.pgbackrest.org bullseye main" > /etc/apt/sources.list.d/pgbackrest.list && \
apt-get update && \
apt-get install -y pgbackrest && \
rm -rf /var/lib/apt/lists/*
# Create necessary directories for pgBackRest
2024-09-26 16:23:02 +00:00
RUN mkdir -p /etc/pgbackrest /var/log/pgbackrest /var/lib/pgbackrest /tmp/pgbackrest/
2024-09-26 15:08:44 +00:00
# Set appropriate permissions for pgBackRest directories
RUN chown -R postgres:postgres /etc/pgbackrest /var/log/pgbackrest /var/lib/pgbackrest
2024-09-26 16:23:02 +00:00
RUN chmod 777 /tmp/pgbackrest/
RUN touch /var/log/pgbackrest/postgres-stanza-create.log
RUN chmod 777 /var/log/pgbackrest/postgres-stanza-create.log
2024-09-26 15:08:44 +00:00
# Copy pgBackRest configuration file
COPY ./pgbackrest/pgbackrest.conf /etc/pgbackrest/pgbackrest.conf
2025-08-08 06:39:07 +00:00
# Copy stanza-create script
COPY ./stanza-create.sh /usr/local/bin/stanza-create.sh
RUN chmod +x /usr/local/bin/stanza-create.sh
2024-09-26 15:08:44 +00:00
# Add a backup script
COPY ./pgbackrest/backup-script.sh /usr/local/bin/backup-script.sh
RUN chmod +x /usr/local/bin/backup-script.sh
# Add the cron job for automated backups
COPY ./pgbackrest/backup-cron /etc/cron.d/backup-cron
RUN chmod 0644 /etc/cron.d/backup-cron
# Apply cron job configuration
2025-08-08 08:25:24 +00:00
# RUN crontab /etc/cron.d/backup-cron
2024-09-26 15:08:44 +00:00
2024-09-26 12:01:05 +00:00
# We add postgis as well to prevent build errors (that we dont see on local builds)
2015-08-08 21:46:13 +00:00
# on docker hub e.g.
# The following packages have unmet dependencies:
2023-07-29 13:07:11 +00:00
2024-09-26 12:56:00 +00:00
RUN set -eux \
&& export DEBIAN_FRONTEND=noninteractive \
2024-09-26 12:56:00 +00:00
&& apt-get update \
&& apt-get -y --no-install-recommends install postgresql-client-${POSTGRES_MAJOR_VERSION} \
postgresql-common postgresql-${POSTGRES_MAJOR_VERSION} \
2021-01-27 18:06:59 +00:00
postgresql-${POSTGRES_MAJOR_VERSION}-postgis-${POSTGIS_MAJOR_VERSION} \
2023-07-29 13:07:11 +00:00
postgresql-${POSTGRES_MAJOR_VERSION}-ogr-fdw \
2021-01-27 18:06:59 +00:00
postgresql-${POSTGRES_MAJOR_VERSION}-postgis-${POSTGIS_MAJOR_VERSION}-scripts \
postgresql-plpython3-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-pgrouting \
2024-09-26 12:56:00 +00:00
postgresql-server-dev-${POSTGRES_MAJOR_VERSION} postgresql-${POSTGRES_MAJOR_VERSION}-cron \
postgresql-${POSTGRES_MAJOR_VERSION}-mysql-fdw && \
2024-09-26 12:01:05 +00:00
pgxn install h3
2024-09-25 11:42:09 +00:00
2024-09-26 12:56:00 +00:00
# Install OpenSSH server and configure SSH
RUN set -eux \
&& apt-get update \
&& apt-get install -y openssh-server \
&& mkdir /var/run/sshd
2024-09-26 13:58:39 +00:00
# Configure SSH to allow root login and use public key authentication
2024-09-26 14:57:15 +00:00
RUN echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config \
2024-09-26 12:56:00 +00:00
&& echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config \
2024-09-26 13:58:39 +00:00
&& echo 'PubkeyAuthentication yes' >> /etc/ssh/sshd_config \
2024-09-26 14:57:15 +00:00
&& echo 'AuthorizedKeysFile /shared-ssh/authorized_keys' >> /etc/ssh/sshd_config \
2024-09-26 13:58:39 +00:00
&& echo 'AllowTcpForwarding yes' >> /etc/ssh/sshd_config \
2024-09-26 14:57:15 +00:00
&& echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
# Set the root password to an empty string
RUN echo 'root:' | chpasswd -e
2024-09-26 12:56:00 +00:00
# Start the SSH service
2024-09-26 12:01:05 +00:00
RUN service ssh start
2024-09-26 16:23:02 +00:00
# Enable archive_mode in postgresql.conf
# Enable archive_mode in postgresql.conf
RUN set -eux \
&& echo "archive_mode = on" >> /etc/postgresql/${POSTGRES_MAJOR_VERSION}/main/postgresql.conf \
&& echo "archive_command = 'pgbackrest --stanza=postgres archive-push %p'" >> /etc/postgresql/${POSTGRES_MAJOR_VERSION}/main/postgresql.conf \
&& echo "archive_timeout = 120s" >> /etc/postgresql/${POSTGRES_MAJOR_VERSION}/main/postgresql.conf
# TODO a case insensitive match would be more robust
RUN if [ "${BUILD_TIMESCALE}" = "true" ]; 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" && \
2024-09-26 12:01:05 +00:00
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | gpg --dearmor -o /usr/share/keyrings/timescale.keyring && \
apt-get update && \
2024-09-26 12:01:05 +00:00
apt-get -y --no-install-recommends install timescaledb-${TIMESCALE_VERSION}-postgresql-${POSTGRES_MAJOR_VERSION} timescaledb-tools;\
fi;
2024-09-26 12:01:05 +00:00
RUN echo $POSTGRES_MAJOR_VERSION >/tmp/pg_version.txt && echo $POSTGIS_MAJOR_VERSION >/tmp/pg_major_version.txt && \
echo $POSTGIS_MINOR_RELEASE >/tmp/pg_minor_version.txt
ENV \
PATH="$PATH:/usr/lib/postgresql/${POSTGRES_MAJOR_VERSION}/bin"
# Compile pointcloud extension
RUN wget -O- https://github.com/pgpointcloud/pointcloud/archive/master.tar.gz | tar xz && \
cd pointcloud-master && \
./autogen.sh && ./configure && make -j 4 && make install && \
cd .. && rm -Rf pointcloud-master
# Cleanup resources
2024-09-26 12:01:05 +00:00
RUN apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
2014-05-04 19:14:46 +00:00
# Open port 5432 so linked containers can see them
2014-05-04 19:14:46 +00:00
EXPOSE 5432
Align 12 with develop (#186) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases. * Added Licence file * add option to mount certificates * fix comments in PR about mounting SSL * Align to develop upstream * Add OGR FDW to the installation and activate it in the docker-compose * Fix spacing in readme * Add replication user and enable postgis rasters drivers * Replicate from restricted IP address * use replication user for streaming changes * update README to higlight new changes * change permisions of default schema to enable replication * add missing env variables * Add logic to cater for destroy database on restart. It can be True or False on start and the logic will handle it * fix for version 12 upgrade * add postgis raster extension * Small fixes for postgresql 12 * Modified docker-compose to run against pg 12 * remove duplicated env variables * Add extra configs for PG 12 (#160) * Replication changes (#153) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases. * Added Licence file * add option to mount certificates * fix comments in PR about mounting SSL * Align to develop upstream * Add OGR FDW to the installation and activate it in the docker-compose * Fix spacing in readme * Add replication user and enable postgis rasters drivers * Replicate from restricted IP address * use replication user for streaming changes * update README to higlight new changes * change permisions of default schema to enable replication * add missing env variables * Add logic to cater for destroy database on restart. It can be True or False on start and the logic will handle it * Fix issues due to feedback * Extra conf (#156) * Add EXTRA_CONF environment variable * Improve readme * Add EXTRA_CONF default vale in env-data.sh * Modified docker-compose to run against pg 12 * remove duplicated env variables * remove duplicated env * Build point cloud and other custome extension, add plpython and pgcron * install pgrouting3 to image (#167) * Disable building community extensions * fix reference to port in docker compose * Cleanup readme * Align 12 branch with develop Co-authored-by: Tim Sutton <tim@kartoza.com> Co-authored-by: Rizky Maulana Nugraha <lana.pcfre@gmail.com> Co-authored-by: Nils <nils.nolde@gmail.com>
2020-01-21 11:03:14 +00:00
# Copy scripts
2021-11-28 05:38:57 +00:00
ADD ./scripts /scripts
WORKDIR /scripts
RUN chmod +x *.sh
2014-05-04 19:14:46 +00:00
# Run any additional tasks here that are too tedious to put in
# this dockerfile directly.
RUN set -eux \
2024-09-26 12:01:05 +00:00
&& /scripts/setup.sh;rm /scripts/.pass_*
2021-06-10 16:27:48 +00:00
RUN echo 'figlet -t "Kartoza Docker PostGIS"' >> ~/.bashrc
2024-09-26 12:01:05 +00:00
2025-08-08 08:00:02 +00:00
ENTRYPOINT ["/bin/bash", "-c", "/scripts/docker-entrypoint.sh"]
2025-08-08 06:39:07 +00:00
2021-01-27 18:06:59 +00:00
2024-09-26 12:01:05 +00:00
2021-01-27 18:06:59 +00:00
##############################################################################
# Testing Stage #
##############################################################################
FROM postgis-prod AS postgis-test
2021-11-28 05:38:57 +00:00
COPY ./scenario_tests/utils/requirements.txt /lib/utils/requirements.txt
2021-01-27 18:06:59 +00:00
RUN set -eux \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get -y --no-install-recommends install python3-pip procps \
2021-01-27 18:06:59 +00:00
&& apt-get -y --purge autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install -r /lib/utils/requirements.txt --break-system-packages