File size: 1,103 Bytes
4bcdfab c48eb55 6b31df9 4bcdfab e730642 792f540 4bcdfab 9611d3b 7a5ce20 4bcdfab 2952197 4bcdfab 646045d f61df7f 646045d 2952197 4bcdfab fe17ad8 4bcdfab f61df7f |
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 33 34 35 36 |
# Start from a basic Python 3.10 image
FROM python:3.10-slim
# Set frontend to noninteractive to avoid prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies needed for the pre-built wheel to work
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /app
# Copy the requirements file first
COPY ./requirements.txt /app/requirements.txt
# Install Python packages
RUN pip install --no-cache-dir --upgrade pip
# This line is correct and fixed your build timeout
RUN pip install --no-cache-dir -r /app/requirements.txt \
--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
# Copy the main application file
COPY ./app.py /app/app.py
# Expose the port that FastAPI (uvicorn) will run on
EXPOSE 7860
# --- THIS IS THE FIX ---
# Instead of just running the script, we tell uvicorn to run the "app"
# object inside the "app.py" file. This starts the server.
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|