chore(docker): dockerfiles improvements and fixes
UIDandGIDbuild arguments forworkeruser. This is useful to not have to change permissions on bind mounted directories.POETRY_EXTRASbuild argument with default values. Useful to re-build the image with some extras using--build-arg POETRY_EXTRAS="..."- Copy
Makefilein Docker image so commands such asmake ingestcan be used - Do NOT copy markdown files. I doubt anyone reads a markdown file within a Docker image
- Fix
PYTHONPATHvalue where path should be/home/worker/app/private_gptinstead of/private_gpt - Set home directory to
/home/workerwhen creating user. This resolves a bunch of side dependencies warnings/problems. - Combine
ENVinstructions together. Just a tiny bit faster to rebuild. - Define environment variables with their defaults
- For documentation purposes
- Reflect defaults set in settings-docker.yml
PGPT_EMBEDDING_MODEto define embedding mode. It's not always the same mode as the llm.- Remove ineffective
python3 -m pipx ensurepath(does not work and is fulfilled byENV PATH="/root/.local/bin:$PATH") - Use
&&instead of;to chain commands to detect failure better
Next PRs (after this one gets merged):
- merge both Dockerfile together. Highly possible especially given the new build argument
POETRY_EXTRAS. - Add missing openai variables and definitions in settings-docker.yaml
- Add docker documentation
- Pick up #1428
Hello All. Please clarify what command is better to use to build docker image locally, upload to GCP and use ? I do not see useful info in documentation related to docker creation
@szastavnyy see https://github.com/zylon-ai/private-gpt/issues/1789#issuecomment-2031351986
@zylon-ai I keep on updating this branch, it would be nice to have a review at some point. Thanks 😉
Published docs preview URL: https://privategpt-preview-4d7135ba-2e40-4816-8fa3-654844aaa338.docs.buildwithfern.com
Updated this PR since it's really useful :) Goal: Implement a better out-of-the-box Docker experience.
I've included:
- Fix Tiktoken cache https://github.com/zylon-ai/private-gpt/issues/1876#issuecomment-2138500112
- Change Docker-compose port to 8001
- Autopulling images when docker image is running
- All requested change by myself
Published docs preview URL: https://privategpt-preview-0b4b3e54-d4ea-42e4-ab4a-2794943cf525.docs.buildwithfern.com
Thanks, sorry for the delay getting back at this PR! I'll rebase other branches I have based off this one soon, for more Docker-related improvements/ease-of-use.