From f73a36af2f3b8b385f99a84d0eb020899f3e0e80 Mon Sep 17 00:00:00 2001 From: Javier Martinez Date: Mon, 12 Aug 2024 12:47:00 +0200 Subject: [PATCH] chore: update entrypoint --- .docker/entrypoint.sh | 12 ++++++++++++ Dockerfile.llamacpp-cpu | 8 +++++++- Dockerfile.ollama | 8 +++++++- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .docker/entrypoint.sh diff --git a/.docker/entrypoint.sh b/.docker/entrypoint.sh new file mode 100644 index 00000000..63221f69 --- /dev/null +++ b/.docker/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Ensure correct ownership of the local_data directory +chown -R worker /home/worker/app/local_data + +# Ensure correct ownership of the models directory if it exists +if [ -d "/home/worker/app/models" ]; then + chown -R worker /home/worker/app/models +fi + +# Execute the command passed to the entrypoint +exec "$@" \ No newline at end of file diff --git a/Dockerfile.llamacpp-cpu b/Dockerfile.llamacpp-cpu index 07a2d066..e1eef1b0 100644 --- a/Dockerfile.llamacpp-cpu +++ b/Dockerfile.llamacpp-cpu @@ -60,5 +60,11 @@ COPY --chown=worker private_gpt/ private_gpt COPY --chown=worker *.yaml . COPY --chown=worker scripts/ scripts +# Copy the entrypoint script and set correct permissions +COPY ./.docker/entrypoint.sh /entrypoint.sh +RUN chown worker /entrypoint.sh && \ + chmod +x /entrypoint.sh + USER worker -ENTRYPOINT python -m private_gpt \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] +CMD ["python", "-m", "private_gpt"] \ No newline at end of file diff --git a/Dockerfile.ollama b/Dockerfile.ollama index 43076ab9..61d6c08d 100644 --- a/Dockerfile.ollama +++ b/Dockerfile.ollama @@ -47,5 +47,11 @@ COPY --chown=worker private_gpt/ private_gpt COPY --chown=worker *.yaml . COPY --chown=worker scripts/ scripts +# Copy the entrypoint script and set correct permissions +COPY ./.docker/entrypoint.sh /entrypoint.sh +RUN chown worker /entrypoint.sh && \ + chmod +x /entrypoint.sh + USER worker -ENTRYPOINT python -m private_gpt +ENTRYPOINT ["/entrypoint.sh"] +CMD ["python", "-m", "private_gpt"]