Skip to content

Commit 05b77a8

Browse files
chore(bdtopo): Corrige le script de mise à jour de la BD Topo
1 parent 040f6c4 commit 05b77a8

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

docker-compose.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ services:
5555
ports:
5656
- 6379:6379
5757

58-
gdal:
59-
# https://github.com/OSGeo/gdal/tree/master/docker
60-
image: ghcr.io/osgeo/gdal:alpine-small-3.8.5
61-
container_name: gdal
62-
profiles: [gdal]
63-
init: true # Forward signals such as Ctrl+C, see: https://docs.docker.com/compose/compose-file/05-services/#init
64-
extra_hosts:
65-
# Allow accessing host ports from this container via host.docker.internal on Linux
66-
# https://stackoverflow.com/a/43541732
67-
- host.docker.internal:host-gateway
68-
6958
mailer:
7059
image: schickling/mailcatcher
7160
ports:

tools/bdtopo_update

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,31 @@ def _sizeof_fmt(num: float, suffix: str = "B") -> str:
1818
num /= 1024.0
1919
return f"{num:.1f} Yi{suffix}"
2020

21+
GDAL_IMAGE = "ghcr.io/osgeo/gdal:alpine-small-3.12.3"
2122

2223
def _run_dockerized_ogr2ogr(database_url, directory: Path, path: Path, options: list):
2324
assert directory.is_absolute()
2425
assert path.is_absolute()
2526

26-
# Make ogr2ogr access database tunnel connection open on the host
27-
# https://stackoverflow.com/a/43541732
28-
urlobj = urlparse(database_url)
29-
database_url_from_container = urlobj._replace(
30-
netloc=f"{urlobj.username}:{urlobj.password}@host.docker.internal:{urlobj.port}"
31-
).geturl()
32-
3327
command = [
3428
"docker",
35-
"compose",
36-
"-f",
37-
"docker-compose.yml",
38-
"--profile",
39-
"gdal",
4029
"run",
41-
"--rm", # Do not leave dead containers
30+
"--rm",
31+
"--init", # Forward signals such as Ctrl+C
32+
# Use host networking so the container can directly access
33+
# database tunnels open on localhost.
34+
"--network",
35+
"host",
4236
"-v",
4337
f"{directory}:/home/data",
44-
"gdal",
38+
GDAL_IMAGE,
4539
"ogr2ogr",
4640
# Setup connection to the PostgreSQL database
4741
# See specific PostgreSQL options here:
4842
# https://gdal.org/drivers/vector/pg.html
4943
"-f",
5044
"PostgreSQL",
51-
f"PG:{database_url_from_container}",
45+
f"PG:{database_url}",
5246
*options,
5347
str(Path("/home/data") / path.relative_to(directory)),
5448
]

0 commit comments

Comments
 (0)