Skip to content

Commit ee3bc1b

Browse files
committed
Add Docker support
1 parent ad7ce15 commit ee3bc1b

File tree

5 files changed

+97
-0
lines changed

5 files changed

+97
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
data
2+
*.osm.pbf

Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.11-bullseye
2+
3+
RUN apt-get update && \
4+
apt-get install -y \
5+
gdal-bin \
6+
parallel \
7+
postgresql-client \
8+
python3-virtualenv
9+
10+
WORKDIR /opt/imposm
11+
RUN wget https://github.com/omniscale/imposm3/releases/download/v0.11.1/imposm-0.11.1-linux-x86-64.tar.gz && \
12+
tar -xvzf imposm-0.11.1-linux-x86-64.tar.gz && \
13+
ln -s /opt/imposm/imposm-0.11.1-linux-x86-64/imposm /usr/bin/imposm
14+
15+
WORKDIR /opt/bano
16+
17+
ADD requirements.txt .
18+
RUN pip install -r requirements.txt

README.md

+40
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,43 @@ load_osm_france_db.sh http://download.openstreetmap.fr/extracts/europe/france/fr
5858
Pour connaître les commandes du module bano : `bano --help`.
5959

6060
Quasiment toutes les options sont utilisées dans le script `cron_bano`.
61+
62+
## Docker
63+
64+
### Configuration
65+
Il ne faut pas modifier le fichier de configuration pour l'exécution avec docker. Pour changer le chemin ou sont stocké les données ajuster le volume data dans `docker-compose`.
66+
67+
```
68+
# Créer l'espace de travail
69+
docker-compose run --rm tools ./arborescence.sh
70+
```
71+
72+
### Initialisation
73+
```
74+
# Démarre Postgres et attend un peu avant de l'utiliser
75+
docker-compose up -d postgres && sleep 5
76+
# Créer les bases de données
77+
docker-compose run --rm tools ./init_base.sh
78+
```
79+
80+
Si besoin de se connecter sur la base de données :
81+
```
82+
docker-compose exec -u postgres postgres psql
83+
```
84+
85+
```
86+
# Charger les données OSM
87+
docker-compose run --rm tools ./load_osm_france_db.sh http://download.openstreetmap.fr/extracts/europe/france/franche_comte/territoire_de_belfort.osm.pbf
88+
89+
# Charger les autres données
90+
docker-compose run --rm tools ./load_fantoir.sh
91+
docker-compose run --rm tools ./load_COG.sh
92+
docker-compose run --rm tools ./load_codes_postaux.sh
93+
docker-compose run --rm tools ./update_cadastre_adresses.sh
94+
docker-compose run --rm tools ./update_table_infos_communes.sh
95+
docker-compose run --rm tools bash -c "source config && python -m bano update_code_cadastre"
96+
97+
### Mise à jour
98+
```
99+
docker-compose run --rm tools ./cron_bano.sh
100+
```

bano/bin.py

+3
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,6 @@ def main():
205205
import ipdb
206206

207207
ipdb.set_trace()
208+
209+
if __name__ == "__main__":
210+
main()

docker-compose.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3.3'
2+
3+
services:
4+
postgres:
5+
image: postgis/postgis:13-3.3-alpine
6+
environment:
7+
- POSTGRES_DB=postgres
8+
- POSTGRES_USER=postgres
9+
- POSTGRES_PASSWORD=postgres
10+
- POSTGRES_HOST_AUTH_METHOD=trust
11+
ports:
12+
- 5432:5432
13+
14+
tools:
15+
build: .
16+
volumes:
17+
- .:/opt/bano
18+
- ./data:/data
19+
environment:
20+
# Postgres
21+
- POSTGRES_DB=postgres
22+
- POSTGRES_USER=postgres
23+
- POSTGRES_PASSWORD=postgres
24+
- POSTGRES_HOST=postgres
25+
- POSTGRES_PORT=5432
26+
# BANO
27+
- SRC_DIR=/opt/bano
28+
- DATA_DIR=/data/bano
29+
- DOWNLOAD_DIR=/data/download
30+
- IMPOSM_CACHE_DIR=/data/bano_imposm_cache
31+
- EXPORT_SAS_DIR=/data/export_sas
32+
- EXPORT_WEB_DIR=/data/export
33+
- TMP_DIR=/data/tmp
34+
- LANG=C

0 commit comments

Comments
 (0)