Spaces:
Running
Running
updated docker file
Browse files- Dockerfile +7 -7
Dockerfile
CHANGED
|
@@ -1,8 +1,5 @@
|
|
| 1 |
FROM python:3.12-slim
|
| 2 |
|
| 3 |
-
# Copy uv from the official image
|
| 4 |
-
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
| 5 |
-
|
| 6 |
# Create a non-root user (Hugging Face Spaces requires user 1000)
|
| 7 |
RUN useradd -m -u 1000 user
|
| 8 |
ENV PATH="/home/user/.local/bin:$PATH"
|
|
@@ -16,6 +13,12 @@ RUN apt-get update && apt-get install -y \
|
|
| 16 |
libgomp1 \
|
| 17 |
&& rm -rf /var/lib/apt/lists/*
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Copy app files with ownership
|
| 20 |
COPY --chown=user:user . .
|
| 21 |
|
|
@@ -24,12 +27,9 @@ RUN mkdir -p /app/database /app/uploads /app/logs && \
|
|
| 24 |
chown -R user:user /app/database /app/uploads /app/logs && \
|
| 25 |
chmod -R 777 /app/database /app/uploads /app/logs
|
| 26 |
|
| 27 |
-
# Switch to the non-root user
|
| 28 |
USER user
|
| 29 |
|
| 30 |
-
# Install Python requirements using uv
|
| 31 |
-
RUN uv pip install --system --no-cache -r requirements.txt
|
| 32 |
-
|
| 33 |
# Hugging Face Spaces exposes port 7860
|
| 34 |
EXPOSE 7860
|
| 35 |
|
|
|
|
| 1 |
FROM python:3.12-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
# Create a non-root user (Hugging Face Spaces requires user 1000)
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
|
|
|
| 13 |
libgomp1 \
|
| 14 |
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# ----------------------------------------------------
|
| 17 |
+
# Install Python requirements AS ROOT
|
| 18 |
+
# ----------------------------------------------------
|
| 19 |
+
COPY requirements.txt .
|
| 20 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
+
|
| 22 |
# Copy app files with ownership
|
| 23 |
COPY --chown=user:user . .
|
| 24 |
|
|
|
|
| 27 |
chown -R user:user /app/database /app/uploads /app/logs && \
|
| 28 |
chmod -R 777 /app/database /app/uploads /app/logs
|
| 29 |
|
| 30 |
+
# Switch to the non-root user (Everything after this runs safely as user 1000)
|
| 31 |
USER user
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
# Hugging Face Spaces exposes port 7860
|
| 34 |
EXPOSE 7860
|
| 35 |
|