I made some changes to the dockerfile, optimizing the codebase for best practices and reducing the size a bit.
Added CUDA Support for the Whisper and embedding models.
Also added an argument to include Ollama in the Image.
Changes.
Merged some steps into one
Commented out (I strongly believe) unused downloads of the "all-MiniLM-L6-v2" default embedding model since it downloads the model in line 75 RUN python -c "import os; from chromadb. utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device=os.environ['RAG_EMBEDDING_MODEL_DEVICE_TYPE'])".
Changed the base image from node to 21-bookworm-slim because 1. deb bookworm is a very stable base and 2. it is a defined version for no automatic latest pulls as this can lead to problems in the future.
Added --no-install-recommends to the apt-get's to reduce image size.
Added some comments.
Note: This should be double checked since this is affecting many users!
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/1165
**Author:** [@jannikstdl](https://github.com/jannikstdl)
**Created:** 3/14/2024
**Status:** ✅ Merged
**Merged:** 4/8/2024
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `dockerfile-optimisation`
---
### 📝 Commits (10+)
- [`50bec32`](https://github.com/open-webui/open-webui/commit/50bec3215338876270c139df2f52845e03023c26) Dockerfile optimisation
- [`384b7e8`](https://github.com/open-webui/open-webui/commit/384b7e8462d6499f32226e94f54b61e24867af7c) changed from bullseye to bookworm + removed unused steps
- [`62ab163`](https://github.com/open-webui/open-webui/commit/62ab163316d736cf3c0b3bd2b9389e5c3426225c) Update Dockerfile
- [`29e48b1`](https://github.com/open-webui/open-webui/commit/29e48b1c1f9bf83cce58e6ea6bc6f620eef9a5f8) Exposed port 8080
- [`75a40de`](https://github.com/open-webui/open-webui/commit/75a40dead6d201b5ea1a242afb8d73962602d22e) Create Dockerfile-cuda
- [`f6cef31`](https://github.com/open-webui/open-webui/commit/f6cef312f2386aebee19da62692c635e8f88c1df) Optimize Dockerfile for CUDA support
- [`e3b1cbb`](https://github.com/open-webui/open-webui/commit/e3b1cbbb86997881f5984b7a6afa2716cf898a61) Parametrize CUDA_VERSION in Dockerfile
- [`c004ecd`](https://github.com/open-webui/open-webui/commit/c004ecdccc8cffc42776626f91d42ebba193bd7d) Refactor Dockerfile for CPU and CUDA builds
- [`c5948d3`](https://github.com/open-webui/open-webui/commit/c5948d3e2ca4bc226753691d438de04352e032cc) Updated Dockerfile for CUDA backend
- [`5abe008`](https://github.com/open-webui/open-webui/commit/5abe0089cb7bf67b639ee241be3f824d58e86cee) cuda support
### 📊 Changes
**7 files changed** (+216 additions, -94 deletions)
<details>
<summary>View changed files</summary>
📝 `.github/workflows/docker-build.yaml` (+26 -10)
📝 `Dockerfile` (+89 -58)
📝 `README.md` (+59 -0)
📝 `backend/apps/audio/main.py` (+6 -1)
📝 `backend/apps/rag/main.py` (+3 -13)
📝 `backend/config.py` (+17 -6)
📝 `backend/start.sh` (+16 -6)
</details>
### 📄 Description
I made some changes to the dockerfile, optimizing the codebase for best practices and reducing the size a bit.
Added CUDA Support for the Whisper and embedding models.
Also added an argument to include Ollama in the Image.
**Changes**.
- Merged some steps into one
- Commented out (I strongly believe) unused downloads of the "all-MiniLM-L6-v2" default embedding model since it downloads the model in line 75 `RUN python -c "import os; from chromadb. utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device=os.environ['RAG_EMBEDDING_MODEL_DEVICE_TYPE'])"`.
- Changed the base image from `node` to `21-bookworm-slim` because 1. deb bookworm is a very stable base and 2. it is a defined version for no automatic latest pulls as this can lead to problems in the future.
- Added `--no-install-recommends` to the apt-get's to reduce image size.
- Added some comments.

Note: This should be double checked since this is affecting many users!
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/1165
Author: @jannikstdl
Created: 3/14/2024
Status: ✅ Merged
Merged: 4/8/2024
Merged by: @tjbck
Base:
dev← Head:dockerfile-optimisation📝 Commits (10+)
50bec32Dockerfile optimisation384b7e8changed from bullseye to bookworm + removed unused steps62ab163Update Dockerfile29e48b1Exposed port 808075a40deCreate Dockerfile-cudaf6cef31Optimize Dockerfile for CUDA supporte3b1cbbParametrize CUDA_VERSION in Dockerfilec004ecdRefactor Dockerfile for CPU and CUDA buildsc5948d3Updated Dockerfile for CUDA backend5abe008cuda support📊 Changes
7 files changed (+216 additions, -94 deletions)
View changed files
📝
.github/workflows/docker-build.yaml(+26 -10)📝
Dockerfile(+89 -58)📝
README.md(+59 -0)📝
backend/apps/audio/main.py(+6 -1)📝
backend/apps/rag/main.py(+3 -13)📝
backend/config.py(+17 -6)📝
backend/start.sh(+16 -6)📄 Description
I made some changes to the dockerfile, optimizing the codebase for best practices and reducing the size a bit.
Added CUDA Support for the Whisper and embedding models.
Also added an argument to include Ollama in the Image.
Changes.
RUN python -c "import os; from chromadb. utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device=os.environ['RAG_EMBEDDING_MODEL_DEVICE_TYPE'])".nodeto21-bookworm-slimbecause 1. deb bookworm is a very stable base and 2. it is a defined version for no automatic latest pulls as this can lead to problems in the future.--no-install-recommendsto the apt-get's to reduce image size.Note: This should be double checked since this is affecting many users!
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.