File size: 697 Bytes
546720a
 
 
efb3b66
546720a
 
efb3b66
546720a
 
 
a4ac1ab
efb3b66
 
93eb9c9
 
 
 
 
 
a4ac1ab
efb3b66
 
a4ac1ab
 
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
# Use the official Python 3.9 image
FROM python:3.9

# Set the working directory
WORKDIR /code

# Copy requirements.txt and install dependencies
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Install Ollama
RUN curl -fsSL https://ollama.com/install.sh | sh

# Create a writable Ollama directory for the non-root user
RUN mkdir -p /home/user/.ollama && chmod -R 777 /home/user/.ollama

# Set environment variables to fix permission issue
ENV OLLAMA_HOME=/home/user/.ollama

# Expose FastAPI's port
EXPOSE 7860

# Start Ollama in the background and then run FastAPI
CMD ollama serve & uvicorn main:app --host 0.0.0.0 --port 7860