|
1 | | -FROM ubuntu:focal AS build |
2 | | - |
3 | | -ENV DEBIAN_FRONTEND noninteractive |
4 | | -ENV LANG C.UTF-8 |
5 | | - |
6 | | -WORKDIR /app |
7 | | - |
8 | | -RUN true \ |
9 | | - # Do not start daemons after installation. |
10 | | - && echo '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d \ |
11 | | - && chmod +x /usr/sbin/policy-rc.d \ |
12 | | - # Install all required packages. |
13 | | - && apt-get -y update -qq \ |
14 | | - && apt-get -y install \ |
15 | | - locales \ |
16 | | - && locale-gen en_US.UTF-8 \ |
17 | | - && update-locale LANG=en_US.UTF-8 \ |
18 | | - && apt-get -y install \ |
19 | | - -o APT::Install-Recommends="false" \ |
20 | | - -o APT::Install-Suggests="false" \ |
21 | | - # Build tools from sources. |
22 | | - build-essential \ |
23 | | - g++ \ |
24 | | - cmake \ |
25 | | - libpq-dev \ |
26 | | - zlib1g-dev \ |
27 | | - libbz2-dev \ |
28 | | - libproj-dev \ |
29 | | - libexpat1-dev \ |
30 | | - libboost-dev \ |
31 | | - libboost-system-dev \ |
32 | | - libboost-filesystem-dev \ |
33 | | - # PostgreSQL. |
34 | | - postgresql-contrib \ |
35 | | - postgresql-server-dev-12 \ |
36 | | - postgresql-12-postgis-3 \ |
37 | | - postgresql-12-postgis-3-scripts \ |
38 | | - # PHP and Apache 2. |
39 | | - php \ |
40 | | - php-intl \ |
41 | | - php-pgsql \ |
42 | | - apache2 \ |
43 | | - libapache2-mod-php \ |
44 | | - # Python 3. |
45 | | - python3-dev \ |
46 | | - python3-pip \ |
47 | | - python3-tidylib \ |
48 | | - python3-psycopg2 \ |
49 | | - python3-setuptools \ |
50 | | - # Misc. |
51 | | - git \ |
52 | | - curl \ |
53 | | - wget \ |
54 | | - sudo |
55 | | - |
56 | | -# Configure postgres. |
57 | | -RUN true \ |
58 | | - && echo "host all all 0.0.0.0/0 trust" >> /etc/postgresql/12/main/pg_hba.conf \ |
59 | | - && echo "listen_addresses='*'" >> /etc/postgresql/12/main/postgresql.conf |
60 | | - |
61 | | -# Osmium install to run continuous updates. |
62 | | -RUN pip3 install osmium |
63 | | - |
64 | | -# Nominatim install. |
65 | | -ENV NOMINATIM_VERSION v3.6.0 |
66 | | - |
67 | | -RUN true \ |
68 | | - && git clone \ |
69 | | - --config advice.detachedHead=false \ |
70 | | - --single-branch \ |
71 | | - --branch $NOMINATIM_VERSION \ |
72 | | - --depth 1 \ |
73 | | - --recursive \ |
74 | | - https://github.com/openstreetmap/Nominatim.git \ |
75 | | - src \ |
76 | | - && cd src \ |
77 | | - && mkdir build \ |
78 | | - && cd build \ |
79 | | - && cmake .. \ |
80 | | - && make -j`nproc` \ |
81 | | - && ./utils/setup.php --setup-website \ |
82 | | - && chmod o=rwx . |
83 | | - |
84 | | -# Apache configure. |
85 | | -# COPY local.php /app/src/build/settings/local.php |
86 | | -COPY nominatim.conf /etc/apache2/sites-enabled/000-default.conf |
87 | | - |
88 | | -# Load initial data. |
89 | | -ARG with_postcodes_gb |
90 | | -ARG with_postcodes_us |
91 | | - |
92 | | -RUN if [ "$with_postcodes_gb" = "" ]; then \ |
93 | | - echo "Skipping optional GB postcode file"; \ |
94 | | - else \ |
95 | | - echo "Downloading optional GB postcode file"; \ |
96 | | - curl http://www.nominatim.org/data/gb_postcode_data.sql.gz > /app/src/data/gb_postcode_data.sql.gz; \ |
97 | | - fi; |
98 | | - |
99 | | -RUN if [ "$with_postcodes_us" = "" ]; then \ |
100 | | - echo "Skipping optional US postcode file"; \ |
101 | | - else \ |
102 | | - echo "Downloading optional US postcode file"; \ |
103 | | - curl http://www.nominatim.org/data/us_postcode_data.sql.gz > /app/src/data/us_postcode_data.sql.gz; \ |
104 | | - fi; |
105 | | - |
106 | | -RUN curl http://www.nominatim.org/data/country_grid.sql.gz > /app/src/data/country_osm_grid.sql.gz |
107 | | - |
108 | | -RUN true \ |
109 | | - # Remove development and unused packages. |
110 | | - && apt-get -y remove --purge \ |
111 | | - cpp-9 \ |
112 | | - gcc-9* \ |
113 | | - g++ \ |
114 | | - git \ |
115 | | - make \ |
116 | | - cmake* \ |
117 | | - llvm-10* \ |
118 | | - libc6-dev \ |
119 | | - linux-libc-dev \ |
120 | | - libclang-*-dev \ |
121 | | - build-essential \ |
122 | | - postgresql-server-dev-12 \ |
123 | | - && apt-get clean \ |
124 | | - # Clear temporary files and directories. |
125 | | - && rm -rf \ |
126 | | - /tmp/* \ |
127 | | - /var/tmp/* \ |
128 | | - /root/.cache \ |
129 | | - /app/src/.git \ |
130 | | - /var/lib/apt/lists/* \ |
131 | | - /var/lib/postgresql/12/main/* |
132 | | - |
133 | | -# Postgres PGDATA as volume |
134 | | -ENV PATH $PATH:/usr/lib/postgresql/12/bin |
135 | | -ENV PGDATA /var/lib/postgresql/data |
136 | | -RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA" |
137 | | -VOLUME /var/lib/postgresql/data |
138 | | - |
139 | | -COPY local_api.php /app/src/build/settings/local_api.php |
140 | | -COPY init.sh /app/init.sh |
141 | | -COPY startapache.sh /app/startapache.sh |
142 | | -COPY startpostgres.sh /app/startpostgres.sh |
143 | | -COPY update.sh /app/update.sh |
144 | | -COPY start.sh /app/start.sh |
145 | | -COPY replace_domain.sh /app/replace_domain.sh |
146 | | - |
147 | | -# Collapse image to single layer. |
148 | | -FROM scratch |
149 | | - |
150 | | -COPY --from=build / / |
151 | | - |
152 | | -WORKDIR /app |
153 | | - |
154 | | -EXPOSE 5432 |
155 | | -EXPOSE 8080 |
| 1 | +FROM mediagis/nominatim:4.0 |
| 2 | +ENV PGDATA=/var/lib/postgresql/12/main |
0 commit comments