From 7b58b5852e77bbbaf3574536c753b6a57f05b7fa Mon Sep 17 00:00:00 2001 From: Francesco Frassinelli Date: Thu, 29 Dec 2022 16:01:09 +0100 Subject: [PATCH] Add wait-for --- Dockerfile | 3 +++ coat2pycsw.py | 2 +- entrypoint.sh | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2ae0210..bc5d526 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM python:3.8 RUN apt-get -q -y update && \ DEBIAN_FRONTEND=noninteractive apt-get -yq install gettext-base +ADD https://raw.githubusercontent.com/eficode/wait-for/v2.2.3/wait-for /wait-for +RUN chmod +x /wait-for RUN python3 -m pip install pdm @@ -13,6 +15,7 @@ RUN pdm install --no-self --group prod COPY coat2pycsw.py pycsw.conf.template entrypoint.sh . COPY mappings/topics.yaml mappings/ ENV PYCSW_CONFIG=/app/pycsw.conf +ENV COAT_URL=https://data.coat.no/ EXPOSE 8000/TCP ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] diff --git a/coat2pycsw.py b/coat2pycsw.py index 67c98cc..02f2302 100755 --- a/coat2pycsw.py +++ b/coat2pycsw.py @@ -12,7 +12,7 @@ from pygeometa.schemas.iso19139 import ISO19139OutputSchema from shapely.geometry import shape -URL = os.getenv("COAT_URL", "https://data.coat.no/") +URL = os.environ["COAT_URL"] def get_datasets(url): diff --git a/entrypoint.sh b/entrypoint.sh index 854ad8b..942a34a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,6 @@ set -xeuo pipefail envsubst < pycsw.conf.template > pycsw.conf -pdm run python3 coat2pycsw.py +/wait-for "$COAT_URL" -- pdm run python3 coat2pycsw.py exec "$@"