Skip to content

Commit f40bb1f

Browse files
committed
fix issue in passing arguments
1 parent 5f687fe commit f40bb1f

5 files changed

Lines changed: 13 additions & 8 deletions

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ RUN initdb -D /var/lib/postgresql/data && \
2626
createdb app && \
2727
psql -d app -c "CREATE EXTENSION postgis;"
2828

29+
COPY docker-entrypoint.sh /usr/local/bin/
2930
COPY app ./app
3031

31-
CMD pg_ctl start -D /var/lib/postgresql/data > /dev/null 2>&1 && python -m app
32+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
33+
34+
CMD ["python", "-m", "app"]

app/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def main() -> None:
2424
pool = Pool(processes)
2525
files = [input_file] if input_file else sorted(input_dir.iterdir())
2626
for file in files:
27-
if overwrite and (output_dir / file.name).exists():
27+
if not overwrite and (output_dir / file.name).exists():
2828
continue
2929
if (
3030
file.is_file()

app/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import re
22
import sqlite3
33
from pathlib import Path
4-
from subprocess import run
4+
from subprocess import PIPE, run
55

66
from psycopg import connect
77

@@ -25,11 +25,11 @@ def get_gpkg_layers(file: Path) -> list[str]:
2525

2626
def is_polygon(file: Path) -> bool:
2727
"""Check if file is a polygon."""
28-
regex = re.compile(r"\((Multi Polygon|Polygon)\)")
28+
regex = re.compile(r"Geometry: (Multi Polygon|Polygon)")
2929
result = run(
30-
["gdal", "vector", "info", "--summary", file],
31-
check=True,
32-
capture_output=True,
30+
["gdal", "vector", "info", "--output-format=text", file],
31+
check=False,
32+
stdout=PIPE,
3333
)
3434
return bool(regex.search(str(result.stdout)))
3535

compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ services:
44
sysctls:
55
- net.ipv4.tcp_keepalive_time=200
66
volumes:
7-
- ./config.ini:/srv/config.ini
87
- ./inputs:/srv/inputs
98
- ./outputs:/srv/outputs

docker-entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
pg_ctl start -D /var/lib/postgresql/data > /dev/null 2>&1
3+
exec "$@"

0 commit comments

Comments
 (0)