FROM python:3.9-slim-bullseye as pdfgpt-chat-img RUN mkdir -p /.jina RUN chmod 777 /.jina RUN mkdir -p /.cache RUN chmod 777 /.cache 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 WORKDIR /app COPY intfloat /app/intfloat COPY app.py app.py COPY api.py api.py EXPOSE 7860 EXPOSE 8080 HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health CMD ["/bin/bash", "-c", "lc-serve deploy local api.py;streamlit run app.py --server.port=7860"]