Skip to content

Commit

Permalink
Improve Dockerfiles for CyclOSM
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddewie committed May 16, 2020
1 parent ca3e858 commit 64461f4
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 5 deletions.
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM ubuntu:bionic

# Style dependencies
RUN apt-get update && apt-get install --no-install-recommends -y \
ca-certificates curl gnupg postgresql-client python fonts-hanazono \
fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted mapnik-utils \
nodejs npm ttf-unifont unzip && rm -rf /var/lib/apt/lists/*

# Kosmtik with plugins, forcing prefix to /usr because bionic sets
# npm prefix to /usr/local, which breaks the install
RUN npm set prefix /usr && npm install -g kosmtik

WORKDIR /usr/lib/node_modules/kosmtik/
RUN kosmtik plugins --install kosmtik-overpass-layer \
--install kosmtik-fetch-remote \
--install kosmtik-overlay \
--install kosmtik-open-in-josm \
--install kosmtik-map-compare \
--install kosmtik-osm-data-overlay \
--install kosmtik-mapnik-reference \
--install kosmtik-geojson-overlay \
&& cp /root/.config/kosmtik.yml /tmp/.kosmtik-config.yml

# Closing section
RUN mkdir -p /cyclosm
WORKDIR /cyclosm

USER 1000
CMD sh scripts/docker-startup.sh kosmtik
3 changes: 3 additions & 0 deletions Dockerfile.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mdillon/postgis:10

ADD ./scripts/tune-postgis.sh /docker-entrypoint-initdb.d
19 changes: 19 additions & 0 deletions Dockerfile.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM ubuntu:bionic

RUN apt-get update && apt-get install --no-install-recommends -y \
ca-certificates curl gnupg && rm -rf /var/lib/apt/lists/*

RUN echo 'deb http:https://ppa.launchpad.net/osmadmins/ppa/ubuntu bionic main\n\
deb-src http:https://ppa.launchpad.net/osmadmins/ppa/ubuntu bionic main' > \
/etc/apt/sources.list.d/osmadmins-ppa.list

RUN apt-key adv --keyserver hkp:https://keyserver.ubuntu.com:80 \
--recv A438A16C88C6BE41CB1616B8D57F48750AC4F2CB

RUN apt-get update && apt-get install --no-install-recommends -y \
osm2pgsql postgresql-client && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /cyclosm
WORKDIR /cyclosm

CMD sh scripts/docker-startup.sh import
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- .:/openstreetmap-carto
- .:/cyclosm
depends_on:
- db
ports:
Expand All @@ -30,7 +30,7 @@ services:
context: .
dockerfile: Dockerfile.import
volumes:
- .:/openstreetmap-carto
- .:/cyclosm
depends_on:
- db
environment:
Expand Down
8 changes: 7 additions & 1 deletion docs/DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You need sufficient disk space of _several Gigabytes_. Docker creates a disk ima
If you are eager to get started here is an overview over the necessary steps.
Read on below to get the details.

* `git clone https://github.com/gravitystorm/openstreetmap-carto.git` to clone openstreetmap-carto repository into a directory on your host system
* `git clone https://github.com/cyclosm/cyclosm-cartocss-style.git` to clone openstreetmap-carto repository into a directory on your host system
* download OpenStreetMap data in osm.pbf format to a file `data.osm.pbf` and place it within the openstreetmap-carto directory (for example some small area from [Geofabrik](https://download.geofabrik.de/))
* If necessary, `sudo service postgresql stop` to make sure you don't have currently running a native PostgreSQL server which would conflict with Docker's PostgreSQL server.
* `docker-compose up import` to import the data (only necessary the first time or when you change the data file)
Expand Down Expand Up @@ -77,3 +77,9 @@ Docker copies log files from the virtual machine into the host system, their [lo
While installing software in the containers and populating the database, the disk image of the virtual machine grows in size, by Docker allocating more clusters. When the disk on the host system is full (only a few MB remaining), Docker can appear stuck. Watch the system log files of your host system for failed allocations.

Docker stores its disk image by default in the home directories of the user. If you don't have enough space here, you can move it elsewhere. (E.g. macOS: Docker > Preferences > Disk).

## Notes

This guide is based on the
[`openstreetmap-carto`](https://github.com/gravitystorm/openstreetmap-carto/blob/master/DOCKER.md)
Docker guide.
3 changes: 1 addition & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
Getting started
===============

This document describes how to manually configure your system for running
CyclOSM.
This document describes how to manually configure your system for running CyclOSM. If you prefer quick, platform independent setup for a development environment, without the need to install and configure tools by hand, follow a Docker installation guide in [DOCKER.md](https://github.com/cyclosm/cyclosm-cartocss-style/blob/master/docs/DOCKER.md).

## Requirements

Expand Down

0 comments on commit 64461f4

Please sign in to comment.