Spaces:
Running
Running
| FROM python:3.12.10 | |
| # 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:/tmp/gradio:$PATH | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME | |
| # Get secret OPENAI_API_KEY and clone it as repo at buildtime / changed required to true | |
| RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true | |
| # Langsmith tracing integration | |
| RUN --mount=type=secret,id=LANGCHAIN_API_KEY,mode=0444,required=true | |
| # HF private spaces token access | |
| RUN --mount=type=secret,id=HUGGINGFACEHUB_API_TOKEN,mode=0444,required=true \ | |
| cat /run/secrets/HUGGINGFACEHUB_API_TOKEN > /home/user/cli_token | |
| # GOOGLE GEMINI API KEY | |
| RUN --mount=type=secret,id=GEMINI_API_KEY,mode=0444,required=true | |
| # LANGSMITH API KEY | |
| RUN --mount=type=secret,id=LANGSMITH_API_KEY,mode=0444,required=true | |
| # Install Git and Git LFS RUN apt-get update && apt-get install -y git-lfs # Initialize Git LFS RUN git lfs install | |
| USER root | |
| RUN apt-get update && apt-get install -y git-lfs | |
| # Initialize Git LFS RUN git lfs install | |
| RUN git lfs install | |
| USER user | |
| RUN pip install -U "huggingface_hub[cli]" | |
| RUN git init & git config --global credential.helper store | |
| RUN hf auth login --token $(cat ${HOME}/cli_token) --add-to-git-credential | |
| # Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
| COPY --chown=user . $HOME | |
| # Clone and run ea4all-agentic-system | |
| RUN git clone https://avfranco:$(cat cli_token)@huggingface.co/spaces/avfranco/problem-first-ai-capstone | |
| WORKDIR ${HOME}/problem-first-ai-capstone | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Install graphviz dependency | |
| USER root | |
| RUN apt-get clean | |
| RUN apt-get update --fix-missing \ | |
| && xargs -a packages.txt apt-get install -y \ | |
| && apt-get clean | |
| USER user | |
| # Start app | |
| CMD ["python","app.py"] |