| # The builder image, used to build the virtual environment | |
| FROM python:3.9 | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Install required packages | |
| #RUN pip install openai chainlit python-dotenv vecs nltk deeplake transformers lancedb chromadb langchain | |
| #RUN pip install llama-index | |
| RUN pip install --no-cache-dir \ | |
| "llama-index==0.6" \ | |
| llama-index-llms-openai \ | |
| llama-index-embeddings-openai \ | |
| llama-index-vector-stores-chroma \ | |
| "chromadb>=0.5.0" \ | |
| chainlit>=1.1.0 \ | |
| tiktoken | |
| # Expose the secret SECRET_EXAMPLE at buildtime and use its value as git remote URL | |
| RUN --mount=type=secret,id=open_ai,mode=0444,required=true \ | |
| cat /run/secrets/open_ai > $HOME/app/app.py | |
| # Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
| COPY --chown=user . $HOME/app | |
| CMD ["chainlit", "run", "/home/user/app/app.py","--port=7860"] | |