File size: 1,223 Bytes
ae6821c
447ea2f
 
593c0eb
 
447ea2f
 
 
 
 
 
ae6821c
 
 
 
 
23dcabd
 
25c46f8
 
 
 
 
 
 
 
ae6821c
447ea2f
ae6821c
 
 
9b2b6d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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"]