2014-05-04 19:14:46 +00:00
|
|
|
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
|
2019-07-30 07:50:52 +00:00
|
|
|
ARG IMAGE_VERSION=buster
|
2020-02-20 18:08:49 +00:00
|
|
|
ARG IMAGE_VARIANT=-slim
|
|
|
|
FROM debian:$IMAGE_VERSION$IMAGE_VARIANT
|
2014-10-20 05:46:56 +00:00
|
|
|
MAINTAINER Tim Sutton<tim@kartoza.com>
|
2014-05-04 19:14:46 +00:00
|
|
|
|
2019-07-30 07:50:52 +00:00
|
|
|
# Reset ARG for version
|
|
|
|
ARG IMAGE_VERSION
|
2014-05-04 19:14:46 +00:00
|
|
|
|
2020-02-20 18:08:49 +00:00
|
|
|
RUN set -eux \
|
|
|
|
&& export DEBIAN_FRONTEND=noninteractive \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get -y --no-install-recommends install \
|
|
|
|
locales gnupg2 wget ca-certificates rpl pwgen software-properties-common gdal-bin iputils-ping \
|
|
|
|
&& 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 - \
|
|
|
|
&& apt-get -y --purge autoremove \
|
|
|
|
&& apt-get clean \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
&& dpkg-divert --local --rename --add /sbin/initctl
|
2019-01-30 19:06:28 +00:00
|
|
|
|
2020-02-20 18:08:49 +00:00
|
|
|
# Generating locales takes a long time. Utilize caching by runnig it by itself
|
|
|
|
# early in the build process.
|
|
|
|
COPY locale.gen /etc/locale.gen
|
|
|
|
RUN set -eux \
|
|
|
|
&& /usr/sbin/locale-gen
|
|
|
|
|
|
|
|
ENV LANG=en_US.UTF-8 \
|
|
|
|
LANGUAGE=en_US:en \
|
|
|
|
LC_ALL=en_US.UTF-8
|
|
|
|
RUN update-locale ${LANG}
|
2014-05-04 19:14:46 +00:00
|
|
|
|
|
|
|
#-------------Application Specific Stuff ----------------------------------------------------
|
|
|
|
|
2015-08-08 21:46:13 +00:00
|
|
|
# We add postgis as well to prevent build errors (that we dont see on local builds)
|
|
|
|
# on docker hub e.g.
|
|
|
|
# The following packages have unmet dependencies:
|
2020-02-20 18:08:49 +00:00
|
|
|
RUN set -eux \
|
|
|
|
&& export DEBIAN_FRONTEND=noninteractive \
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get -y --no-install-recommends install postgresql-client-12 \
|
|
|
|
postgresql-common postgresql-12 postgresql-12-postgis-3 \
|
|
|
|
netcat postgresql-12-ogr-fdw postgresql-12-postgis-3-scripts \
|
|
|
|
postgresql-12-cron postgresql-plpython3-12 \
|
|
|
|
&& apt-get -y --purge autoremove \
|
|
|
|
&& apt-get clean \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2014-05-04 19:14:46 +00:00
|
|
|
|
2014-08-05 08:45:28 +00:00
|
|
|
# Open port 5432 so linked containers can see them
|
2014-05-04 19:14:46 +00:00
|
|
|
EXPOSE 5432
|
2020-01-21 11:03:14 +00:00
|
|
|
|
2020-02-20 18:08:49 +00:00
|
|
|
# Copy scripts
|
|
|
|
COPY docker-entrypoint.sh \
|
|
|
|
env-data.sh \
|
|
|
|
setup.sh \
|
|
|
|
setup-conf.sh \
|
|
|
|
setup-database.sh \
|
|
|
|
setup-pg_hba.sh \
|
|
|
|
setup-replication.sh \
|
|
|
|
setup-ssl.sh \
|
|
|
|
setup-user.sh \
|
|
|
|
/
|
|
|
|
|
2014-05-04 19:14:46 +00:00
|
|
|
# Run any additional tasks here that are too tedious to put in
|
|
|
|
# this dockerfile directly.
|
2020-02-20 18:08:49 +00:00
|
|
|
RUN set -eux \
|
|
|
|
&& chmod +x /setup.sh \
|
|
|
|
&& /setup.sh \
|
|
|
|
&& chmod +x /docker-entrypoint.sh
|
2019-12-02 13:14:29 +00:00
|
|
|
|
2020-02-20 18:08:49 +00:00
|
|
|
VOLUME /var/lib/postgresql
|
2018-03-21 20:53:39 +00:00
|
|
|
|
|
|
|
ENTRYPOINT /docker-entrypoint.sh
|