Spaces:
Sleeping
Sleeping
Melika Kheirieh commited on
Commit ·
9231424
1
Parent(s): aa4ed26
feat(hf-space): add fully compatible Dockerfile for HuggingFace runtime
Browse files- Dockerfile +10 -7
Dockerfile
CHANGED
|
@@ -1,20 +1,23 @@
|
|
| 1 |
FROM python:3.12-slim
|
| 2 |
|
| 3 |
-
ENV
|
|
|
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
-
PIP_NO_CACHE_DIR=1 \
|
| 6 |
PORT=7860 \
|
| 7 |
GRADIO_SERVER_NAME=0.0.0.0
|
| 8 |
|
|
|
|
| 9 |
WORKDIR /home/user/app
|
| 10 |
|
| 11 |
-
|
| 12 |
-
RUN
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
EXPOSE 7860
|
| 17 |
|
| 18 |
-
# Ensure base image ENTRYPOINT (if any) doesn't override ours
|
| 19 |
ENTRYPOINT []
|
| 20 |
CMD ["python", "-u", "start.py"]
|
|
|
|
| 1 |
FROM python:3.12-slim
|
| 2 |
|
| 3 |
+
ENV PIP_NO_CACHE_DIR=1 \
|
| 4 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 5 |
PYTHONUNBUFFERED=1 \
|
|
|
|
| 6 |
PORT=7860 \
|
| 7 |
GRADIO_SERVER_NAME=0.0.0.0
|
| 8 |
|
| 9 |
+
# HuggingFace mounts your repository at /home/user/app in RUN time
|
| 10 |
WORKDIR /home/user/app
|
| 11 |
|
| 12 |
+
# Install Python dependencies — requirements.txt is mounted at run time → accessible here
|
| 13 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
+
gcc build-essential && \
|
| 15 |
+
pip install --no-cache-dir -U pip && \
|
| 16 |
+
pip install --no-cache-dir -r requirements.txt && \
|
| 17 |
+
apt-get purge -y gcc build-essential && \
|
| 18 |
+
apt-get autoremove -y && apt-get clean -y
|
| 19 |
|
| 20 |
EXPOSE 7860
|
| 21 |
|
|
|
|
| 22 |
ENTRYPOINT []
|
| 23 |
CMD ["python", "-u", "start.py"]
|