diff --git a/dhub/settings.py b/dhub/settings.py index 8ca3094..0703e2e 100644 --- a/dhub/settings.py +++ b/dhub/settings.py @@ -246,3 +246,4 @@ COMMIT = config('COMMIT', default='') TOKEN_DLT = config("TOKEN_DLT", default=None) API_DLT = config("API_DLT", default=None) API_RESOLVER = config("API_RESOLVER", default=None) +ID_FEDERATED = config("ID_FEDERATED", default=None) diff --git a/docker/devicehub-django.Dockerfile b/docker/devicehub-django.Dockerfile index 3e0a591..6f5ec95 100644 --- a/docker/devicehub-django.Dockerfile +++ b/docker/devicehub-django.Dockerfile @@ -8,8 +8,13 @@ RUN apt update && \ sqlite3 \ jq \ time \ + vim \ && rm -rf /var/lib/apt/lists/* +# TODO I don't like this, but the whole ereuse-dpp works with user 1000 because of the volume mapping +# thanks https://stackoverflow.com/questions/70520205/docker-non-root-user-best-practices-for-python-images +RUN adduser --home /opt/devicehub-django -u 1000 app + WORKDIR /opt/devicehub-django # reduce size (python specifics) -> src https://stackoverflow.com/questions/74616667/removing-pip-cache-after-installing-dependencies-in-docker-image @@ -37,9 +42,7 @@ ENV PYTHONPATH="${PYTHONPATH}:/usr/lib/python3/dist-packages" COPY docker/devicehub-django.entrypoint.sh / -# TODO I don't like this, but the whole ereuse-dpp works with user 1000 because of the volume mapping -# thanks https://stackoverflow.com/questions/70520205/docker-non-root-user-best-practices-for-python-images -RUN adduser --system --no-create-home app -USER app +RUN chown -R app:app /opt/devicehub-django +USER app ENTRYPOINT sh /devicehub-django.entrypoint.sh diff --git a/docker/devicehub-django.entrypoint.sh b/docker/devicehub-django.entrypoint.sh index da7f4a2..de19a4d 100644 --- a/docker/devicehub-django.entrypoint.sh +++ b/docker/devicehub-django.entrypoint.sh @@ -35,24 +35,21 @@ gen_env_vars() { PREDEFINED_TOKEN="${PREDEFINED_TOKEN:-}" # specific dpp env vars if [ "${DPP_MODULE}" = 'y' ]; then - # docker situation - if [ -d "${DPP_SHARED:-}" ]; then - wait_for_dpp_shared - export API_DLT='http://api_connector:3010' - export API_DLT_TOKEN="$(cat "/shared/${OPERATOR_TOKEN_FILE}")" - export API_RESOLVER='http://id_index_api:3012' - # TODO hardcoded - export ID_FEDERATED='DH1' - # .env situation - else - dpp_env_vars="$(cat <