File size: 680 Bytes
eaade1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use the official Python 3.10.9 image
FROM python:3.10.9

# Expose the port FastAPI will run on
EXPOSE 7860

# Set environment variables for FastAPI and OpenAI API keys
ARG FASTAPI_KEY
ARG OPENAI_API_KEY

ENV FASTAPI_KEY=$FASTAPI_KEY
ENV OPENAI_API_KEY=$OPENAI_API_KEY
ENV PYTHONUNBUFFERED=1

# Set the working directory
WORKDIR /code

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

# Copy the app directory
COPY ./app /code/app

# Start the FastAPI app on port 7860
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]