Spaces:
Sleeping
Sleeping
# Use a base image (Python 3.10 slim) | |
FROM python:3.10-slim | |
ENV HF_HOME=/data | |
# Set working directory | |
WORKDIR /code | |
# Copy requirements first to leverage Docker cache | |
COPY ./requirements.txt /code/requirements.txt | |
# Install system dependencies (curl for downloading), Python dependencies, | |
# create /data dir, check for model and download if missing, then clean up. | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends curl && \ | |
pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r /code/requirements.txt | |
# RUN echo "Checking for model file in /data..." && \ | |
# if [ ! -f /data/zephyr-7b-beta.Q4_K_M.gguf ]; then \ | |
# echo "Model file not found. Downloading..." && \ | |
# curl -L -o /data/zephyr-7b-beta.Q4_K_M.gguf https://huggingface.co/TheBloke/zephyr-7B-beta-GGUF/resolve/main/zephyr-7b-beta.Q4_K_M.gguf && \ | |
# echo "Download complete."; \ | |
# else \ | |
# echo "Model file already exists."; \ | |
# fi | |
# Copy the rest of the application code from the build context to the container | |
COPY . /code/ | |
# Set the command to run the Gradio app (app.py) | |
# HF Spaces usually figures this out, but explicitly setting it is fine. | |
CMD ["python", "app.py"] |