Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python image
|
| 2 |
+
FROM python:3.12-slim
|
| 3 |
+
|
| 4 |
+
# Install uv for fast dependency installation
|
| 5 |
+
COPY --from=ghcr.io/astral-sh/uv:0.4.20 /uv /bin/uv
|
| 6 |
+
|
| 7 |
+
# Create a non-root user (important for Hugging Face security)
|
| 8 |
+
RUN useradd -m -u 1000 user
|
| 9 |
+
USER user
|
| 10 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 11 |
+
ENV UV_SYSTEM_PYTHON=1
|
| 12 |
+
|
| 13 |
+
WORKDIR /app
|
| 14 |
+
|
| 15 |
+
# Copy and install dependencies
|
| 16 |
+
COPY --chown=user requirements.txt .
|
| 17 |
+
RUN uv pip install -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Copy all project files (folders like data/, pages/, etc.)
|
| 20 |
+
COPY --chown=user . .
|
| 21 |
+
|
| 22 |
+
# Tell HF which port to use
|
| 23 |
+
EXPOSE 7860
|
| 24 |
+
|
| 25 |
+
# Start the app
|
| 26 |
+
CMD ["python", "app.py"]
|