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"]