diff --git a/ckan-pycsw/Dockerfile b/ckan-pycsw/Dockerfile index 9392db4..c19dbc7 100644 --- a/ckan-pycsw/Dockerfile +++ b/ckan-pycsw/Dockerfile @@ -41,8 +41,5 @@ RUN pdm install --no-self --group prod COPY ckan-pycsw/conf/pycsw.conf.template ckan-pycsw/docker-entrypoint.d/entrypoint.sh ./ COPY ckan2pycsw ckan2pycsw -# Switch to root user to change permissions of folders in entrypoint. Then switch back to non-root user. -USER root - ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] CMD ["tail", "-f", "/dev/null"] \ No newline at end of file diff --git a/ckan-pycsw/Dockerfile.dev b/ckan-pycsw/Dockerfile.dev index 047c009..76a589d 100644 --- a/ckan-pycsw/Dockerfile.dev +++ b/ckan-pycsw/Dockerfile.dev @@ -27,8 +27,5 @@ RUN apt-get -q -y update && apt-get install -y --no-install-recommends \ debugpy==1.8.0 && \ rm -rf /var/lib/apt/lists/* -# Switch to root user to change permissions of folders in entrypoint. Then switch back to non-root user. -USER root - ENTRYPOINT ["/bin/bash", "-c", "python3 -m debugpy --listen 0.0.0.0:${PYCSW_DEV_PORT} --wait-for-client ./docker-entrypoint.d/entrypoint_dev.sh"] CMD ["pdm", "run", "python3", "-m", "gunicorn", "pycsw.wsgi:application", "-b", "0.0.0.0:${PYCSW_PORT}"] \ No newline at end of file diff --git a/ckan-pycsw/Dockerfile.ghcr b/ckan-pycsw/Dockerfile.ghcr index 2995c35..9de5f48 100644 --- a/ckan-pycsw/Dockerfile.ghcr +++ b/ckan-pycsw/Dockerfile.ghcr @@ -18,8 +18,6 @@ ENV PYCSW_CRON_HOUR_START=4 WORKDIR ${APP_DIR} # Update files if needed -COPY ckan-pycsw/conf/pycsw.conf.template ckan-pycsw/docker-entrypoint.d/entrypoint.sh ./ - -USER $USERNAME +COPY pycsw/conf/pycsw.conf.template docker-entrypoint.d/entrypoint.sh ./ ENTRYPOINT ["/bin/bash", "./entrypoint.sh"] \ No newline at end of file diff --git a/ckan-pycsw/docker-entrypoint.d/entrypoint.sh b/ckan-pycsw/docker-entrypoint.d/entrypoint.sh index ecaa58e..9e24c2e 100644 --- a/ckan-pycsw/docker-entrypoint.d/entrypoint.sh +++ b/ckan-pycsw/docker-entrypoint.d/entrypoint.sh @@ -2,16 +2,9 @@ set -xeuo pipefail -# Change ownership of log and metadata directories -chown -R $USERNAME:$USERNAME ${APP_DIR}/log -chown -R $USERNAME:$USERNAME ${APP_DIR}/metadata - -# Switch to the non-root user -su - $USERNAME - envsubst < pycsw.conf.template > pycsw.conf #TODO: -Xfrozen_modules=off from: https://bugs.python.org/issue1666807 /wait-for --timeout "$TIMEOUT" "$CKAN_URL" -- pdm run python3 -Xfrozen_modules=off ckan2pycsw/ckan2pycsw.py -exec "$@" \ No newline at end of file +exec "$@" diff --git a/ckan-pycsw/docker-entrypoint.d/entrypoint_dev.sh b/ckan-pycsw/docker-entrypoint.d/entrypoint_dev.sh index 2d4f998..e663fb2 100644 --- a/ckan-pycsw/docker-entrypoint.d/entrypoint_dev.sh +++ b/ckan-pycsw/docker-entrypoint.d/entrypoint_dev.sh @@ -2,13 +2,6 @@ set -xeuo pipefail -# Change ownership of log and metadata directories -chown -R $USERNAME:$USERNAME ${APP_DIR}/log -chown -R $USERNAME:$USERNAME ${APP_DIR}/metadata - -# Switch to the non-root user -su - $USERNAME - envsubst < pycsw.conf.template > pycsw.conf /wait-for --timeout "$TIMEOUT" "$CKAN_URL" -- pdm run python3 -m ptvsd --host 0.0.0.0 --port "$PYCSW_DEV_PORT" --wait ckan2pycsw/ckan2pycsw.py