fugthchat commited on
Commit
a40d418
·
verified ·
1 Parent(s): 39395e6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -14
Dockerfile CHANGED
@@ -1,27 +1,26 @@
1
- # Use a standard Python image
2
  FROM python:3.10-slim
3
 
4
  # Set the working directory in the container
5
  WORKDIR /code
6
 
7
- # Install build tools needed for llama-cpp-python (cmake is essential)
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- gcc \
10
- g++ \
11
- make \
12
- cmake \
13
- && rm -rf /var/lib/apt/lists/*
14
 
15
- # Copy the requirements file and install dependencies
16
  COPY ./requirements.txt /code/requirements.txt
17
- RUN pip install --no-cache-dir --upgrade pip && \
18
- pip install --no-cache-dir -r /code/requirements.txt
19
 
20
- # Copy the application code
 
 
 
21
  COPY ./app.py /code/app.py
22
 
23
- # Expose the port the app runs on
24
  EXPOSE 7860
25
 
26
- # Command to run the application
 
27
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use a standard Python slim image
2
  FROM python:3.10-slim
3
 
4
  # Set the working directory in the container
5
  WORKDIR /code
6
 
7
+ # Set environment variable to build llama-cpp-python for CPU only
8
+ # This avoids errors on Hugging Face's CPU infrastructure
9
+ ENV CMAKE_ARGS="-DLLAMA_CUBLAS=OFF -DLLAMA_CUDA_F16=OFF -DLLAMA_HIPBLAS=OFF -DLLAMA_METAL=OFF"
10
+ ENV FORCE_CMAKE=1
 
 
 
11
 
12
+ # Copy the requirements file into the container
13
  COPY ./requirements.txt /code/requirements.txt
 
 
14
 
15
+ # Install the Python dependencies
16
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
17
+
18
+ # Copy the rest of the application code
19
  COPY ./app.py /code/app.py
20
 
21
+ # Expose the port the app runs on (Hugging Face default is 7860)
22
  EXPOSE 7860
23
 
24
+ # Command to run the application using uvicorn
25
+ # The app will be available at http://0.0.0.0:7860
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]