Update Dockerfile
Browse files- Dockerfile +24 -11
Dockerfile
CHANGED
|
@@ -1,19 +1,32 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
# Install
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
WORKDIR /app
|
| 10 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
|
|
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
EXPOSE 7860
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Start from a basic Python 3.10 image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set frontend to noninteractive to avoid prompts
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
|
| 7 |
+
# Install system dependencies needed to *build* llama-cpp-python
|
| 8 |
+
# This fixes compile errors.
|
| 9 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
+
build-essential \
|
| 11 |
+
cmake \
|
| 12 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
+
|
| 14 |
+
# Set the working directory inside the container
|
| 15 |
WORKDIR /app
|
|
|
|
| 16 |
|
| 17 |
+
# Copy the requirements file first
|
| 18 |
+
COPY ./requirements.txt /app/requirements.txt
|
| 19 |
|
| 20 |
+
# Install Python packages
|
| 21 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 22 |
+
RUN pip install --no-cache-dir -r /app/requirements.txt
|
| 23 |
|
| 24 |
+
# Copy the main application file
|
| 25 |
+
COPY ./app.py /app/app.py
|
| 26 |
+
|
| 27 |
+
# Expose the port that FastAPI (uvicorn) will run on
|
| 28 |
EXPOSE 7860
|
| 29 |
+
|
| 30 |
+
# Command to run the application
|
| 31 |
+
# This starts app.py, which will THEN download the model.
|
| 32 |
+
CMD ["python", "app.py"]
|