add Dockerfile

This commit is contained in:
Hugoren Martinako 2021-04-02 19:18:17 +02:00
parent 3fdbefb5ff
commit aa3dca2b64
3 changed files with 24 additions and 2 deletions

16
Dockerfile Normal file
View File

@ -0,0 +1,16 @@
FROM ubuntu:latest
LABEL maintainer="aumpfbahn@gmail.com"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update \
&& apt-get -y install postgresql-client postgis osm2pgsql curl osmium-tool npm \
&& apt-get -y clean
RUN service postgresql start \
&& su - postgres -c "createuser --superuser root; createdb osm" \
&& psql -d osm -c 'CREATE EXTENSION postgis; CREATE EXTENSION unaccent;'
COPY . /root
WORKDIR /root
ENTRYPOINT service postgresql start && bash

View File

@ -6,7 +6,13 @@ La fuente original de datos es https://download.geofabrik.de/europe/spain.html y
- [osmium-tool](https://osmcode.org/osmium-tool/) unirá en un solo fichero _.pbf_ los datos descargados de Geofabrik (_spain_ + _canary-islands_)
- [osm2pgsql](https://osm2pgsql.org/doc/install.html) insertará el _.pbf_ del paso anterior en la base de datos. Es necesario tener una [base de datos postgres](https://osm2pgsql.org/doc/manual.html#preparing-the-database) instalada, con su correspondiente extensión [PostGIS](https://postgis.net/).
- [nodejs](https://nodejs.org/en/) (opcional, solo para _merge_) utilizará la herramienta `npx` para ejecutar [mapshaper](https://github.com/mbloch/mapshaper) que es quién unirá en un fichero geográfico (topojson) los datos CSV con los GeoJSON.
- [nodejs](https://nodejs.org/en/) (opcional, solo para _merge_) utilizará la herramienta `npx` para ejecutar [mapshaper](https://github.com/mbloch/mapshaper) que es quién unirá en un fichero geográfico (topojson) los datos CSV con los GeoJSON.
## Docker
Se puede levantar el entorno utilizando docker con dos pasos, primero contruye la imagen y después arranca el contenedor:
```
$ docker build -t ${PWD##*/} . && docker run -it ${PWD##*/}
```
## Herramientas
Ejecutar los distintos comandos desde el directorio raíz.

View File

@ -43,7 +43,7 @@ do
if [ $(wc -l ${output} | cut -d ' ' -f 1) -gt 1 ]; then
echo -ne "[ \033[0;32mOK\033[0m ]\t"
else
echo -ne "[ \033[0;33mwarn\033[0m ]\t"
echo -ne "[ \033[0;33mwarn\033[0m ]\t"
fi
else
echo -ne "[ \033[0;31merror\033[0m ]\t"