Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- Dockerfile +18 -9
Dockerfile
CHANGED
|
@@ -4,28 +4,37 @@ FROM python:3.12-slim
|
|
| 4 |
# Set a working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Prevent Python from buffering stdout/stderr (helps
|
| 8 |
ENV PYTHONUNBUFFERED=1
|
| 9 |
|
| 10 |
-
#
|
| 11 |
ARG LICENSING_SERVICE_BASE
|
| 12 |
ARG API_KEY
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
#
|
| 15 |
ENV LICENSING_SERVICE_BASE=${LICENSING_SERVICE_BASE}
|
| 16 |
ENV API_KEY=${API_KEY}
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Copy and install dependencies
|
| 19 |
COPY requirements.txt .
|
| 20 |
RUN pip install --upgrade pip \
|
| 21 |
-
&& pip install --no-cache-dir -r requirements.txt
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
COPY . .
|
| 25 |
|
| 26 |
-
# Expose the
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
-
# Default command:
|
| 30 |
CMD ["python", "gradio_bot3.py"]
|
| 31 |
-
|
|
|
|
| 4 |
# Set a working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Prevent Python from buffering stdout/stderr (helps with real-time logs)
|
| 8 |
ENV PYTHONUNBUFFERED=1
|
| 9 |
|
| 10 |
+
# Build-time args for your licensing service and HF deployment
|
| 11 |
ARG LICENSING_SERVICE_BASE
|
| 12 |
ARG API_KEY
|
| 13 |
+
ARG HF_TOKEN
|
| 14 |
+
ARG HF_REPO_ID
|
| 15 |
|
| 16 |
+
# Expose both as env vars in the container
|
| 17 |
ENV LICENSING_SERVICE_BASE=${LICENSING_SERVICE_BASE}
|
| 18 |
ENV API_KEY=${API_KEY}
|
| 19 |
+
ENV HF_TOKEN=${HF_TOKEN}
|
| 20 |
+
ENV HF_REPO_ID=${HF_REPO_ID}
|
| 21 |
|
| 22 |
# Copy and install dependencies
|
| 23 |
COPY requirements.txt .
|
| 24 |
RUN pip install --upgrade pip \
|
| 25 |
+
&& pip install --no-cache-dir -r requirements.txt
|
| 26 |
+
# Install Hugging Face CLI
|
| 27 |
+
RUN pip install --no-cache-dir "huggingface_hub[cli]" \
|
| 28 |
+
&& huggingface-cli login --token "$HF_TOKEN" \
|
| 29 |
+
&& printf "%s\n%s\n%s\n\n\nn\nn\n" \
|
| 30 |
+
"$HF_TOKEN" "y" "$HF_REPO_ID" \
|
| 31 |
+
| gradio deploy
|
| 32 |
+
|
| 33 |
+
# Copy your Gradio app code
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
+
# Expose the Gradio port
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
+
# Default command: start your app
|
| 40 |
CMD ["python", "gradio_bot3.py"]
|
|
|