forked from peter-evans/nominatim-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
107 lines (90 loc) · 2.82 KB
/
Dockerfile
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
ARG nominatim_version=3.5.2
FROM peterevans/xenial-gcloud:1.2.23 as builder
ARG nominatim_version
# Let the container know that there is no TTY
ARG DEBIAN_FRONTEND=noninteractive
# Install packages
RUN apt-get -y update \
&& apt-get install -y -qq --no-install-recommends \
build-essential \
cmake \
g++ \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
libexpat1-dev \
zlib1g-dev \
libxml2-dev \
libbz2-dev \
libpq-dev \
libgeos-dev \
libgeos++-dev \
libproj-dev \
postgresql-server-dev-9.5 \
php \
curl
# Build Nominatim
RUN cd /srv \
&& curl --silent -L -k http://www.nominatim.org/release/Nominatim-${nominatim_version}.tar.bz2 -o v${nominatim_version}.tar.bz2 \
&& tar xf v${nominatim_version}.tar.bz2 \
&& rm v${nominatim_version}.tar.bz2 \
&& mv Nominatim-${nominatim_version} nominatim \
&& cd nominatim \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make
FROM peterevans/xenial-gcloud:1.2.23
ARG nominatim_version
LABEL \
maintainer="Peter Evans <[email protected]>" \
org.opencontainers.image.title="nominatim-k8s" \
org.opencontainers.image.description="Nominatim for Kubernetes on Google Container Engine (GKE)." \
org.opencontainers.image.authors="Peter Evans <[email protected]>" \
org.opencontainers.image.url="https://github.com/peter-evans/nominatim-k8s" \
org.opencontainers.image.vendor="https://peterevans.dev" \
org.opencontainers.image.licenses="MIT" \
app.tag="nominatim${nominatim_version}"
# Let the container know that there is no TTY
ARG DEBIAN_FRONTEND=noninteractive
# Set locale and install packages
ENV LANG C.UTF-8
RUN apt-get -y update \
&& apt-get install -y -qq --no-install-recommends locales \
&& locale-gen en_US.UTF-8 \
&& update-locale LANG=en_US.UTF-8 \
&& apt-get install -y -qq --no-install-recommends \
postgresql-server-dev-9.5 \
postgresql-9.5-postgis-2.2 \
postgresql-contrib-9.5 \
apache2 \
php \
php-pgsql \
libapache2-mod-php \
libboost-filesystem-dev \
php-pear \
php-db \
php-intl \
python3-dev \
python3-psycopg2 \
curl \
ca-certificates \
sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* /var/tmp/*
# Copy the application from the builder image
COPY --from=builder /srv/nominatim /srv/nominatim
# Configure Nominatim
COPY local.php /srv/nominatim/build/settings/local.php
# Configure Apache
COPY nominatim.conf /etc/apache2/sites-enabled/000-default.conf
# Allow remote connections to PostgreSQL
RUN echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/9.5/main/pg_hba.conf \
&& echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf
# Set the entrypoint
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
EXPOSE 5432
EXPOSE 8080