Spaces:
Running
Running
Commit ·
5f041a3
1
Parent(s): 5b833b9
fixed the docker
Browse files- Dockerfile +14 -3
Dockerfile
CHANGED
|
@@ -3,15 +3,26 @@ FROM python:3.10-slim
|
|
| 3 |
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
# Install system dependencies
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
curl \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Copy only necessary files
|
| 12 |
-
COPY requirements.txt ./
|
| 13 |
-
COPY app/ ./app/
|
| 14 |
-
COPY README.md ./
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Install dependencies with verbose output and error handling
|
| 17 |
RUN pip install --no-cache-dir --upgrade pip && \
|
|
|
|
| 3 |
# Set working directory
|
| 4 |
WORKDIR /app
|
| 5 |
|
| 6 |
+
# Create a non-root user
|
| 7 |
+
RUN useradd -m -u 1000 appuser
|
| 8 |
+
|
| 9 |
# Install system dependencies
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
curl \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# Set up cache directory for Hugging Face
|
| 15 |
+
ENV HF_HOME=/app/.cache/huggingface
|
| 16 |
+
RUN mkdir -p /app/.cache/huggingface && \
|
| 17 |
+
chown -R appuser:appuser /app
|
| 18 |
+
|
| 19 |
# Copy only necessary files
|
| 20 |
+
COPY --chown=appuser:appuser requirements.txt ./
|
| 21 |
+
COPY --chown=appuser:appuser app/ ./app/
|
| 22 |
+
COPY --chown=appuser:appuser README.md ./
|
| 23 |
+
|
| 24 |
+
# Switch to non-root user
|
| 25 |
+
USER appuser
|
| 26 |
|
| 27 |
# Install dependencies with verbose output and error handling
|
| 28 |
RUN pip install --no-cache-dir --upgrade pip && \
|