Spaces:
Build error
Build error
FROM python:3.9-slim-bullseye as pdfgpt-chat-img | |
RUN apt-get update && apt-get install -y \ | |
build-essential \ | |
curl \ | |
software-properties-common \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Expose the secret OPENAI_API_KEY at buildtime and use its value as git remote URL | |
RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true \ | |
git init && \ | |
git remote add origin $(cat /run/secrets/OPENAI_API_KEY) | |
COPY requirements_pytorch.txt requirements_pytorch.txt | |
COPY requirements_api.txt requirements_api.txt | |
COPY requirements_app.txt requirements_app.txt | |
RUN pip3 install -r requirements_pytorch.txt | |
RUN pip3 install -r requirements_api.txt | |
RUN pip3 install -r requirements_app.txt | |
COPY intfloat /intfloat | |
COPY app.py app.py | |
COPY api.py api.py | |
# 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 | |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
COPY --chown=user . $HOME/app | |
EXPOSE 7860 | |
EXPOSE 8080 | |
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health | |
CMD ["lc-serve", "deploy", "local", "api.py", "&&", "streamlit", "run", "app.py", "--server.port=7860"] |