Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
cd91d8a9
Commit
cd91d8a9
authored
Apr 10, 2024
by
Jun Siang Cheah
Browse files
run apt install first for better potential layer caching
parent
eddaa7fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
31 deletions
+31
-31
Dockerfile
Dockerfile
+31
-31
No files found.
Dockerfile
View file @
cd91d8a9
...
@@ -67,43 +67,43 @@ ENV RAG_EMBEDDING_MODEL="$USE_EMBEDDING_MODEL_DOCKER" \
...
@@ -67,43 +67,43 @@ ENV RAG_EMBEDDING_MODEL="$USE_EMBEDDING_MODEL_DOCKER" \
#### Other models
##########################################################
#### Other models
##########################################################
WORKDIR
/app/backend
WORKDIR
/app/backend
# install python dependencies
COPY
./backend/requirements.txt ./requirements.txt
RUN if
[
"
$USE_CUDA
"
=
"true"
]
;
then
\
RUN if
[
"
$USE_OLLAMA
"
=
"true"
]
;
then
\
# If you use CUDA the whisper and embedding modell will be downloaded on first use
apt-get update
&&
\
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \
# Install pandoc and netcat
pip3 install -r requirements.txt --no-cache-dir && \
apt-get install -y --no-install-recommends pandoc netcat-openbsd && \
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])" && \
# for RAG OCR
python -c "import os; from chromadb.utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device='cpu')"; \
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
# install helper tools
apt-get install -y --no-install-recommends curl && \
# install ollama
curl -fsSL https://ollama.com/install.sh | sh && \
# cleanup
rm -rf /var/lib/apt/lists/*; \
else \
else \
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
apt-get update && \
pip3 install -r requirements.txt --no-cache-dir && \
# Install pandoc and netcat
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])" && \
apt-get install -y --no-install-recommends pandoc netcat-openbsd && \
python -c "import os; from chromadb.utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device='cpu')"; \
# for RAG OCR
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
# cleanup
rm -rf /var/lib/apt/lists/*; \
fi
fi
# install python dependencies
COPY
./backend/requirements.txt ./requirements.txt
RUN if
[
"
$USE_OLLAMA
"
=
"true"
]
;
then
\
RUN if
[
"
$USE_CUDA
"
=
"true"
]
;
then
\
apt-get update
&&
\
# If you use CUDA the whisper and embedding model will be downloaded on first use
# Install pandoc and netcat
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \
apt-get install -y --no-install-recommends pandoc netcat-openbsd && \
pip3 install -r requirements.txt --no-cache-dir && \
# for RAG OCR
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])" && \
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
python -c "import os; from chromadb.utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device='cpu')"; \
# install helper tools
apt-get install -y --no-install-recommends curl && \
# install ollama
curl -fsSL https://ollama.com/install.sh | sh && \
# cleanup
rm -rf /var/lib/apt/lists/*; \
else \
else \
apt-get update && \
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
# Install pandoc and netcat
pip3 install -r requirements.txt --no-cache-dir && \
apt-get install -y --no-install-recommends pandoc netcat-openbsd && \
python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])" && \
# for RAG OCR
python -c "import os; from chromadb.utils import embedding_functions; sentence_transformer_ef = embedding_functions.SentenceTransformerEmbeddingFunction(model_name=os.environ['RAG_EMBEDDING_MODEL'], device='cpu')"; \
apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \
# cleanup
rm -rf /var/lib/apt/lists/*; \
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment