-
Notifications
You must be signed in to change notification settings - Fork 23
/
Dockerfile
21 lines (16 loc) · 783 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM python:3.10
# Clone the repository
WORKDIR /code
# Copy the necessary files (you may skip this if already in the repository)
COPY database/pipeline.pkl /code/database/pipeline.pkl
COPY requirements.txt /code/requirements.txt
COPY setup.py /code/setup.py
COPY knowledge_database /code/knowledge_database
COPY api /code/api
# Install Python dependencies
RUN pip install pip --upgrade
RUN pip install --no-cache-dir -r requirements.txt
# Set up the secret environment variable for OpenAI API Key
RUN --mount=type=secret,id=OPENAI_API_KEY sh -c 'echo "export OPENAI_API_KEY=$(cat /run/secrets/OPENAI_API_KEY)" >> /etc/profile.d/openai.sh'
# Set the command to run the application
CMD ["/bin/bash", "-c", "source /etc/profile && uvicorn api.api:app --host 0.0.0.0 --port 8080"]