thryyyyy commited on
Commit
760d992
·
1 Parent(s): eee5d07

fix DockerFile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -9
Dockerfile CHANGED
@@ -133,27 +133,35 @@ RUN if [ "$USE_OLLAMA" = "true" ]; then \
133
  # install python dependencies
134
  COPY --chown=$UID:$GID ./backend/requirements.txt ./requirements.txt
135
 
136
- RUN pip3 install --no-cache-dir uv && \
137
- RUN pip3 install huggingface_hub
138
- RUN pip3 install uv && \
139
- if [ "$USE_CUDA" = "true" ]; then \
140
  # If you use CUDA the whisper and embedding model will be downloaded on first use
 
141
  pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \
 
142
  uv pip install --system -r requirements.txt --no-cache-dir && \
 
143
  python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
144
- 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'])"; \
 
 
145
  python -c "import os; import tiktoken; tiktoken.get_encoding(os.environ['TIKTOKEN_ENCODING_NAME'])"; \
146
  else \
 
147
  pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
 
148
  uv pip install --system -r requirements.txt --no-cache-dir && \
 
149
  python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
150
- 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'])"; \
 
 
151
  python -c "import os; import tiktoken; tiktoken.get_encoding(os.environ['TIKTOKEN_ENCODING_NAME'])"; \
152
- fi; \
 
153
  chown -R $UID:$GID /app/backend/data/
154
 
155
-
156
-
157
  # copy embedding weight from build
158
  # RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
159
  # COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx
 
133
  # install python dependencies
134
  COPY --chown=$UID:$GID ./backend/requirements.txt ./requirements.txt
135
 
136
+ RUN pip3 install --no-cache-dir uv huggingface_hub
137
+
138
+ RUN if [ "$USE_CUDA" = "true" ]; then \
 
139
  # If you use CUDA the whisper and embedding model will be downloaded on first use
140
+ echo "Installing PyTorch with CUDA support ($USE_CUDA_DOCKER_VER)..." && \
141
  pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \
142
+ echo "Installing requirements using uv..." && \
143
  uv pip install --system -r requirements.txt --no-cache-dir && \
144
+ echo "Pre-downloading embedding model..." && \
145
  python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
146
+ echo "Pre-downloading whisper model..." && \
147
+ 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'])" && \
148
+ echo "Pre-downloading tiktoken encoding..." && \
149
  python -c "import os; import tiktoken; tiktoken.get_encoding(os.environ['TIKTOKEN_ENCODING_NAME'])"; \
150
  else \
151
+ echo "Installing PyTorch with CPU support..." && \
152
  pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \
153
+ echo "Installing requirements using uv..." && \
154
  uv pip install --system -r requirements.txt --no-cache-dir && \
155
+ echo "Pre-downloading embedding model..." && \
156
  python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \
157
+ echo "Pre-downloading whisper model..." && \
158
+ 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'])" && \
159
+ echo "Pre-downloading tiktoken encoding..." && \
160
  python -c "import os; import tiktoken; tiktoken.get_encoding(os.environ['TIKTOKEN_ENCODING_NAME'])"; \
161
+ fi && \
162
+ echo "Setting final ownership..." && \
163
  chown -R $UID:$GID /app/backend/data/
164
 
 
 
165
  # copy embedding weight from build
166
  # RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2
167
  # COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx