Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -3
Dockerfile
CHANGED
|
@@ -31,19 +31,32 @@ RUN CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install --no-cache-dir llama-cpp-python==
|
|
| 31 |
COPY requirements.txt .
|
| 32 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
# Copy app code
|
| 35 |
COPY . .
|
|
|
|
| 36 |
|
| 37 |
# Create models directory
|
| 38 |
-
RUN mkdir -p models
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
|
| 42 |
|
| 43 |
# Environment variables
|
| 44 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 45 |
ENV GRADIO_SERVER_PORT=7860
|
| 46 |
ENV CUDA_VISIBLE_DEVICES=0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
# Start app
|
| 49 |
CMD ["python", "app.py"]
|
|
|
|
| 31 |
COPY requirements.txt .
|
| 32 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
| 34 |
+
# Create a non-root user
|
| 35 |
+
RUN useradd -m -u 1000 user
|
| 36 |
+
|
| 37 |
+
# Create cache directory with proper permissions
|
| 38 |
+
RUN mkdir -p /app/.cache/huggingface
|
| 39 |
+
RUN chown -R user:user /app
|
| 40 |
+
|
| 41 |
# Copy app code
|
| 42 |
COPY . .
|
| 43 |
+
RUN chown -R user:user /app
|
| 44 |
|
| 45 |
# Create models directory
|
| 46 |
+
RUN mkdir -p models && chown -R user:user models
|
| 47 |
|
| 48 |
+
# Switch to non-root user
|
| 49 |
+
USER user
|
| 50 |
|
| 51 |
# Environment variables
|
| 52 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 53 |
ENV GRADIO_SERVER_PORT=7860
|
| 54 |
ENV CUDA_VISIBLE_DEVICES=0
|
| 55 |
+
ENV HF_HOME=/app/.cache/huggingface
|
| 56 |
+
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
|
| 57 |
+
|
| 58 |
+
# Expose Gradio port
|
| 59 |
+
EXPOSE 7860
|
| 60 |
|
| 61 |
# Start app
|
| 62 |
CMD ["python", "app.py"]
|