forked from kartoza/docker-postgis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
73 lines (62 loc) · 2.36 KB
/
Dockerfile
File metadata and controls
73 lines (62 loc) · 2.36 KB
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
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
ARG IMAGE_VERSION=buster
ARG IMAGE_VARIANT=-slim
FROM debian:$IMAGE_VERSION$IMAGE_VARIANT
MAINTAINER Tim Sutton<tim@kartoza.com>
# Reset ARG for version
ARG IMAGE_VERSION
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
# 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}
#-------------Application Specific Stuff ----------------------------------------------------
# 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:
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/*
# Open port 5432 so linked containers can see them
EXPOSE 5432
# 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 \
/
# Run any additional tasks here that are too tedious to put in
# this dockerfile directly.
RUN set -eux \
&& chmod +x /setup.sh \
&& /setup.sh \
&& chmod +x /docker-entrypoint.sh
VOLUME /var/lib/postgresql
ENTRYPOINT /docker-entrypoint.sh