Bahodir Nematjonov commited on
Commit
bdf1c9b
·
1 Parent(s): 93eb9c9
Files changed (1) hide show
  1. Dockerfile +7 -7
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Use the official Python 3.9 image
2
  FROM python:3.9
3
 
4
- # Set the working directory
5
  WORKDIR /code
6
 
7
  # Copy requirements.txt and install dependencies
@@ -11,14 +11,14 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
  # Install Ollama
12
  RUN curl -fsSL https://ollama.com/install.sh | sh
13
 
14
- # Create a writable Ollama directory for the non-root user
15
  RUN mkdir -p /home/user/.ollama && chmod -R 777 /home/user/.ollama
16
 
17
- # Set environment variables to fix permission issue
18
- ENV OLLAMA_HOME=/home/user/.ollama
19
 
20
- # Expose FastAPI's port
21
  EXPOSE 7860
22
 
23
- # Start Ollama in the background and then run FastAPI
24
- CMD ollama serve & uvicorn main:app --host 0.0.0.0 --port 7860
 
1
  # Use the official Python 3.9 image
2
  FROM python:3.9
3
 
4
+ # Set working directory
5
  WORKDIR /code
6
 
7
  # Copy requirements.txt and install dependencies
 
11
  # Install Ollama
12
  RUN curl -fsSL https://ollama.com/install.sh | sh
13
 
14
+ # Create a writable directory for Ollama
15
  RUN mkdir -p /home/user/.ollama && chmod -R 777 /home/user/.ollama
16
 
17
+ # Set Ollama to use this directory
18
+ ENV OLLAMA_DIR=/home/user/.ollama
19
 
20
+ # Expose the FastAPI port
21
  EXPOSE 7860
22
 
23
+ # Start Ollama in the background and then FastAPI
24
+ CMD ollama serve --dir $OLLAMA_DIR & uvicorn main:app --host 0.0.0.0 --port 7860