-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce dependencies for updates, switch to Ubuntu 22.04 (#234)
- Loading branch information
Showing
5 changed files
with
56 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,14 @@ | ||
FROM ubuntu:20.04 AS compiler-common | ||
FROM ubuntu:22.04 AS compiler-common | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
git-core \ | ||
checkinstall \ | ||
g++ \ | ||
gnupg2 \ | ||
make \ | ||
tar \ | ||
wget \ | ||
ca-certificates \ | ||
&& apt-get update | ||
|
||
########################################################################################################### | ||
|
||
FROM compiler-common AS compiler-postgis | ||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ | ||
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
postgresql-server-dev-14 \ | ||
libxml2-dev \ | ||
libgeos-dev \ | ||
libproj-dev \ | ||
&& wget https://download.osgeo.org/postgis/source/postgis-3.2.1.tar.gz -O postgis.tar.gz \ | ||
&& mkdir -p postgis_src \ | ||
&& tar -xvzf postgis.tar.gz --strip 1 -C postgis_src \ | ||
&& rm postgis.tar.gz \ | ||
&& cd postgis_src \ | ||
&& ./configure --without-protobuf --without-raster \ | ||
&& make -j $(nproc) \ | ||
&& checkinstall --pkgversion="3.2.1" --install=no --default make install | ||
|
||
########################################################################################################### | ||
|
||
FROM compiler-common AS compiler-osm2pgsql | ||
RUN apt-get install -y --no-install-recommends \ | ||
cmake \ | ||
libboost-dev \ | ||
libboost-system-dev \ | ||
libboost-filesystem-dev \ | ||
libexpat1-dev \ | ||
zlib1g-dev \ | ||
libbz2-dev \ | ||
libpq-dev \ | ||
libproj-dev \ | ||
lua5.3 \ | ||
liblua5.3-dev \ | ||
pandoc | ||
RUN cd ~ \ | ||
&& git clone -b master --single-branch https://github.com/openstreetmap/osm2pgsql.git --depth 1 \ | ||
&& cd osm2pgsql \ | ||
&& mkdir build \ | ||
&& cd build \ | ||
&& cmake .. \ | ||
&& make -j $(nproc) \ | ||
&& checkinstall --pkgversion="1" --install=no --default make install | ||
|
||
########################################################################################################### | ||
|
||
FROM compiler-common AS compiler-modtile-renderd | ||
RUN apt-get install -y --no-install-recommends \ | ||
apache2-dev \ | ||
automake \ | ||
autoconf \ | ||
autotools-dev \ | ||
libtool \ | ||
libmapnik-dev | ||
RUN cd ~ \ | ||
&& git clone -b switch2osm --single-branch https://github.com/SomeoneElseOSM/mod_tile.git --depth 1 \ | ||
&& cd mod_tile \ | ||
&& ./autogen.sh \ | ||
&& ./configure \ | ||
&& make -j $(nproc) \ | ||
&& checkinstall --pkgversion="1" --install=no --pkgname "renderd" --default make install \ | ||
&& checkinstall --pkgversion="1" --install=no --pkgname "mod_tile" --default make install-mod_tile | ||
|
||
########################################################################################################### | ||
|
||
FROM compiler-common AS compiler-stylesheet | ||
RUN cd ~ \ | ||
&& git clone --single-branch --branch v5.4.0 https://github.com/gravitystorm/openstreetmap-carto.git --depth 1 \ | ||
|
@@ -97,7 +27,7 @@ RUN mkdir -p /home/renderer/src \ | |
|
||
########################################################################################################### | ||
|
||
FROM ubuntu:20.04 AS final | ||
FROM ubuntu:22.04 AS final | ||
|
||
# Based on | ||
# https://switch2osm.org/serving-tiles/manually-building-a-tile-server-18-04-lts/ | ||
|
@@ -111,30 +41,33 @@ RUN apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | ||
apache2 \ | ||
cron \ | ||
dateutils \ | ||
fonts-noto-cjk \ | ||
fonts-noto-hinted \ | ||
fonts-noto-unhinted \ | ||
fonts-unifont \ | ||
gnupg2 \ | ||
gdal-bin \ | ||
liblua5.3-dev \ | ||
lua5.3 \ | ||
mapnik-utils \ | ||
npm \ | ||
osm2pgsql \ | ||
osmium-tool \ | ||
osmosis \ | ||
postgresql-14 \ | ||
postgresql-14-postgis-3 \ | ||
postgresql-14-postgis-3-scripts \ | ||
postgis \ | ||
python-is-python3 \ | ||
python3-mapnik \ | ||
python3-lxml \ | ||
python3-psycopg2 \ | ||
python3-shapely \ | ||
python3-pip \ | ||
renderd \ | ||
sudo \ | ||
ttf-unifont \ | ||
wget \ | ||
&& echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \ | ||
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ | ||
&& apt-get update \ | ||
&& apt-get install -y --no-install-recommends postgresql-14 \ | ||
&& apt-get clean autoclean \ | ||
&& apt-get autoremove --yes \ | ||
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ | ||
|
@@ -146,16 +79,12 @@ RUN pip3 install \ | |
requests \ | ||
osmium \ | ||
pyyaml | ||
|
||
# Install carto for stylesheet | ||
RUN npm install -g [email protected] | ||
|
||
# Configure Apache | ||
RUN mkdir /var/lib/mod_tile \ | ||
&& chown renderer /var/lib/mod_tile \ | ||
&& mkdir /var/run/renderd \ | ||
&& chown renderer /var/run/renderd \ | ||
&& echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \ | ||
RUN echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf \ | ||
&& echo "LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so" >> /etc/apache2/conf-available/mod_headers.conf \ | ||
&& a2enconf mod_tile && a2enconf mod_headers | ||
COPY apache.conf /etc/apache2/sites-available/000-default.conf | ||
|
@@ -179,43 +108,28 @@ RUN chown -R postgres:postgres /var/lib/postgresql \ | |
&& echo "host all all ::/0 md5" >> /etc/postgresql/14/main/pg_hba.conf | ||
|
||
# Create volume directories | ||
RUN mkdir -p /data/database/ \ | ||
RUN mkdir -p /run/renderd/ \ | ||
&& mkdir -p /data/database/ \ | ||
&& mkdir -p /data/style/ \ | ||
&& mkdir -p /home/renderer/src/ \ | ||
&& chown -R renderer: /data/ \ | ||
&& chown -R renderer: /home/renderer/src/ \ | ||
&& chown -R renderer: /run/renderd \ | ||
&& mv /var/lib/postgresql/14/main/ /data/database/postgres/ \ | ||
&& mv /var/lib/mod_tile/ /data/tiles/ \ | ||
&& mv /var/cache/renderd/tiles/ /data/tiles/ \ | ||
&& chown -R renderer: /data/tiles \ | ||
&& ln -s /data/database/postgres /var/lib/postgresql/14/main \ | ||
&& ln -s /data/style /home/renderer/src/openstreetmap-carto \ | ||
&& ln -s /data/tiles /var/lib/mod_tile \ | ||
&& ln -s /data/tiles /var/cache/renderd/tiles \ | ||
; | ||
|
||
# Install PostGIS | ||
COPY --from=compiler-postgis postgis_src/postgis-src_3.2.1-1_amd64.deb . | ||
RUN dpkg -i postgis-src_3.2.1-1_amd64.deb \ | ||
&& rm postgis-src_3.2.1-1_amd64.deb | ||
|
||
# Install osm2pgsql | ||
COPY --from=compiler-osm2pgsql /root/osm2pgsql/build/build_1-1_amd64.deb . | ||
RUN dpkg -i build_1-1_amd64.deb \ | ||
&& rm build_1-1_amd64.deb | ||
|
||
# Install renderd | ||
COPY --from=compiler-modtile-renderd /root/mod_tile/renderd_1-1_amd64.deb . | ||
RUN dpkg -i renderd_1-1_amd64.deb \ | ||
&& rm renderd_1-1_amd64.deb \ | ||
&& sed -i 's/renderaccount/renderer/g' /usr/local/etc/renderd.conf \ | ||
&& sed -i 's/\/truetype//g' /usr/local/etc/renderd.conf \ | ||
&& sed -i 's/hot/tile/g' /usr/local/etc/renderd.conf | ||
|
||
# Install mod_tile | ||
COPY --from=compiler-modtile-renderd /root/mod_tile/mod-tile_1-1_amd64.deb . | ||
RUN dpkg -i mod-tile_1-1_amd64.deb \ | ||
&& ldconfig \ | ||
&& rm mod-tile_1-1_amd64.deb | ||
|
||
COPY --from=compiler-modtile-renderd /root/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag | ||
RUN echo '[default] \n\ | ||
URI=/tile/ \n\ | ||
TILEDIR=/var/cache/renderd/tiles \n\ | ||
XML=/home/renderer/src/openstreetmap-carto/mapnik.xml \n\ | ||
HOST=localhost \n\ | ||
TILESIZE=256 \n\ | ||
MAXZOOM=20' >> /etc/renderd.conf | ||
|
||
# Install helper script | ||
COPY --from=compiler-helper-script /home/renderer/src/regional /home/renderer/src/regional | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters