File size: 979 Bytes
10d6a86
 
 
 
 
 
 
 
 
f6d989a
 
768986b
 
f6d989a
439aec6
10d6a86
 
 
 
 
 
 
439aec6
e850c75
 
439aec6
cd03528
10d6a86
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
27
28
FROM python:3.10-slim

ENV PYTHONDONTWRITEBYTECODE 1  
# ^ saves space by not writing .pyc files
ENV PYTHONUNBUFFERED 1  
# ^ ensures that the output from the Python app is sent straight to the terminal without being buffered -> real time monitoring

ENV ENVIRONMENT=dev 

ENV $(cat /run/secrets/FINRAG_WEAVIATE_API_KEY)
ENV $(cat /run/secrets/FINRAG_WEAVIATE_ENDPOINT)
ENV $(cat /run/secrets/LLAMA_PARSE_API_KEY)
ENV $(cat /run/secrets/OPENAI_API_KEY)
# ^ https://huggingface.co/docs/hub/en/spaces-sdks-docker#secrets

COPY ./app /app
WORKDIR /app
RUN mkdir /data

RUN pip install --no-cache-dir --upgrade -r requirements.txt
# ^ no caching of the packages to save space

# RUN python -c "import nltk; nltk.download('stopwords')"
# ^ to fix runtime error, see https://github.com/run-llama/llama_index/issues/10681

RUN chmod -R 777 /usr/local/lib/python3.10/site-packages//llama_index/legacy/_static/nltk_cache

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]