From 400d5b3a0d3bddff0ff238ff387c05a997e1c752 Mon Sep 17 00:00:00 2001 From: Sajjad Anwar Date: Tue, 1 Mar 2022 21:25:01 +0530 Subject: [PATCH 1/3] wip coastline --- compose/osmcoastline.yml | 16 +++++++ envs/.env.osmcoastline.example | 1 + images/osmcoastline/Dockerfile | 82 ++++++++++++++++++++++++++++++++++ images/osmcoastline/start.sh | 3 ++ 4 files changed, 102 insertions(+) create mode 100644 compose/osmcoastline.yml create mode 100644 envs/.env.osmcoastline.example create mode 100644 images/osmcoastline/Dockerfile create mode 100755 images/osmcoastline/start.sh diff --git a/compose/osmcoastline.yml b/compose/osmcoastline.yml new file mode 100644 index 00000000..ee42d5b5 --- /dev/null +++ b/compose/osmcoastline.yml @@ -0,0 +1,16 @@ +version: '3' +services: + ##################################################### + ## OSM Coastline + ##################################################### + osmcoastline: + platform: linux/amd64 + image: osmseed-osmcoastline:v1 + build: + context: ../images/osmcoastline + dockerfile: Dockerfile + volumes: + - ../data/osmcoastline-data:/mnt/data + env_file: + - ../envs/.env.osmcoastline + \ No newline at end of file diff --git a/envs/.env.osmcoastline.example b/envs/.env.osmcoastline.example new file mode 100644 index 00000000..6e8090a1 --- /dev/null +++ b/envs/.env.osmcoastline.example @@ -0,0 +1 @@ +IMPORT_PBF_URL=https://download.geofabrik.de/europe/monaco-latest.osm.pbf \ No newline at end of file diff --git a/images/osmcoastline/Dockerfile b/images/osmcoastline/Dockerfile new file mode 100644 index 00000000..736c3d9f --- /dev/null +++ b/images/osmcoastline/Dockerfile @@ -0,0 +1,82 @@ +FROM ubuntu:20.04 +ENV workdir /mnt/data + +RUN apt-get -y update +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install \ + build-essential \ + libboost-program-options-dev \ + libbz2-dev \ + zlib1g-dev \ + libexpat1-dev \ + cmake \ + pandoc \ + git \ + python3 \ + python3-pip \ + curl \ + unzip \ + wget \ + software-properties-common \ + libz-dev \ + gdal-bin \ + tar \ + bzip2 \ + clang \ + default-jre \ + default-jdk \ + gradle \ + apt-utils \ + postgresql-client \ + libgeos-dev \ + sqlite3 \ + spatialite-bin + + +#Install osmium-tool +RUN apt-get -y install \ + libbz2-dev \ + libgd-dev \ + libprotozero-dev \ + libsqlite3-dev \ + make \ + jq \ + ca-certificates \ + liblz4-dev + +WORKDIR $workdir +RUN git clone https://github.com/osmcode/libosmium.git +RUN cd libosmium && git checkout v2.18.0 +RUN mkdir build +WORKDIR $workdir/libosmium/build +RUN cmake .. +RUN make .. + +# Other useful packages +RUN apt-get install -y \ + rsync \ + tmux \ + zsh \ + libgdal-dev + +WORKDIR $workdir +RUN echo 'hello' +RUN git clone https://github.com/osmcode/osmcoastline.git +RUN cd osmcoastline && git checkout v2.3.1 && mkdir build +WORKDIR $workdir/osmcoastline/build +RUN cmake .. +RUN make + +# # Install AWS CLI +# RUN pip install awscli + +# # Install GCP CLI +# RUN curl -sSL https://sdk.cloud.google.com | bash +# RUN ln -f -s /root/google-cloud-sdk/bin/gsutil /usr/bin/gsutil + +# # Install Azure CLI +# RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash + +WORKDIR $workdir +COPY start.sh start.sh +RUN chmod +x start.sh +CMD ./start.sh diff --git a/images/osmcoastline/start.sh b/images/osmcoastline/start.sh new file mode 100755 index 00000000..7752d9c0 --- /dev/null +++ b/images/osmcoastline/start.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -e +echo 'Hello' \ No newline at end of file From ec75ded96a0da9d66835e640102cac933097bbd8 Mon Sep 17 00:00:00 2001 From: Sajjad Anwar Date: Wed, 2 Mar 2022 15:57:42 +0530 Subject: [PATCH 2/3] fix script path. create symlink --- images/osmcoastline/Dockerfile | 9 +++++---- images/osmcoastline/start.sh | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/images/osmcoastline/Dockerfile b/images/osmcoastline/Dockerfile index 736c3d9f..076a6e60 100644 --- a/images/osmcoastline/Dockerfile +++ b/images/osmcoastline/Dockerfile @@ -65,7 +65,8 @@ RUN cd osmcoastline && git checkout v2.3.1 && mkdir build WORKDIR $workdir/osmcoastline/build RUN cmake .. RUN make - +RUN ln -s "$PWD"/src/osmcoastline /usr/bin/osmcoastline +RUN osmcoastline --version # # Install AWS CLI # RUN pip install awscli @@ -77,6 +78,6 @@ RUN make # RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash WORKDIR $workdir -COPY start.sh start.sh -RUN chmod +x start.sh -CMD ./start.sh +COPY start.sh /start.sh +RUN chmod +x /start.sh +CMD /start.sh diff --git a/images/osmcoastline/start.sh b/images/osmcoastline/start.sh index 7752d9c0..f210dfaf 100755 --- a/images/osmcoastline/start.sh +++ b/images/osmcoastline/start.sh @@ -1,3 +1,5 @@ -#!/bin/bash set -e -echo 'Hello' \ No newline at end of file + +echo "Running coastline on $IMPORT_PBF_URL" +# wget $IMPORT_PBF_URL -O planet.pbf +osmcoastline -o coastline.db planet.pbf From 7542f9febb12ec922bb3c9df6e779aa5fa6547df Mon Sep 17 00:00:00 2001 From: Sajjad Anwar Date: Wed, 2 Mar 2022 20:56:23 +0530 Subject: [PATCH 3/3] install tools inside the container not on the volume --- images/osmcoastline/Dockerfile | 13 +++++++------ images/osmcoastline/start.sh | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/images/osmcoastline/Dockerfile b/images/osmcoastline/Dockerfile index 076a6e60..12391ee0 100644 --- a/images/osmcoastline/Dockerfile +++ b/images/osmcoastline/Dockerfile @@ -43,11 +43,11 @@ RUN apt-get -y install \ ca-certificates \ liblz4-dev -WORKDIR $workdir +WORKDIR /home RUN git clone https://github.com/osmcode/libosmium.git RUN cd libosmium && git checkout v2.18.0 -RUN mkdir build -WORKDIR $workdir/libosmium/build +RUN cd libosmium && mkdir build +WORKDIR /home/libosmium/build RUN cmake .. RUN make .. @@ -58,14 +58,14 @@ RUN apt-get install -y \ zsh \ libgdal-dev -WORKDIR $workdir +WORKDIR /home RUN echo 'hello' RUN git clone https://github.com/osmcode/osmcoastline.git RUN cd osmcoastline && git checkout v2.3.1 && mkdir build -WORKDIR $workdir/osmcoastline/build +WORKDIR /home/osmcoastline/build RUN cmake .. RUN make -RUN ln -s "$PWD"/src/osmcoastline /usr/bin/osmcoastline +RUN ln -s "$PWD"/src/osmcoastline /usr/local/bin/osmcoastline RUN osmcoastline --version # # Install AWS CLI # RUN pip install awscli @@ -77,6 +77,7 @@ RUN osmcoastline --version # # Install Azure CLI # RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash +VOLUME $workdir WORKDIR $workdir COPY start.sh /start.sh RUN chmod +x /start.sh diff --git a/images/osmcoastline/start.sh b/images/osmcoastline/start.sh index f210dfaf..fdeb0e0f 100755 --- a/images/osmcoastline/start.sh +++ b/images/osmcoastline/start.sh @@ -1,5 +1,5 @@ set -e echo "Running coastline on $IMPORT_PBF_URL" -# wget $IMPORT_PBF_URL -O planet.pbf +wget $IMPORT_PBF_URL -O planet.pbf osmcoastline -o coastline.db planet.pbf