Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +22 -0
Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 1. Base Image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
# 2. Install Git
|
| 5 |
+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
| 6 |
+
|
| 7 |
+
WORKDIR /app
|
| 8 |
+
|
| 9 |
+
# 3. FETCH PRIVATE CODE
|
| 10 |
+
# This mounts your HF_TOKEN secret just long enough to clone your private vault
|
| 11 |
+
RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=true \
|
| 12 |
+
git clone https://user:$(cat /run/secrets/HF_TOKEN)@huggingface.co/spaces/YourUsername/YourPrivateVault .
|
| 13 |
+
|
| 14 |
+
# 4. INSTALL & RUN
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Force Gradio/Flask to use the correct port for HF
|
| 18 |
+
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 19 |
+
ENV GRADIO_SERVER_PORT=7860
|
| 20 |
+
EXPOSE 7860
|
| 21 |
+
|
| 22 |
+
CMD ["python", "app.py"]
|