| |
| FROM nvidia/cuda:11.2.2-cudnn8-devel-ubuntu20.04 |
|
|
| |
| ENV DEBIAN_FRONTEND=noninteractive |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| software-properties-common \ |
| && add-apt-repository ppa:deadsnakes/ppa \ |
| && apt-get update \ |
| && apt-get install -y \ |
| python3.9 \ |
| python3.9-distutils \ |
| python3.9-dev \ |
| python3-pip \ |
| build-essential \ |
| wget \ |
| ffmpeg \ |
| libsm6 \ |
| libxext6 \ |
| libgl1-mesa-glx \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 |
| RUN update-alternatives --set python3 /usr/bin/python3.9 |
|
|
| |
| RUN wget https://bootstrap.pypa.io/get-pip.py && \ |
| python3 get-pip.py && \ |
| rm get-pip.py |
|
|
| |
| RUN useradd -m -u 1000 user |
|
|
| |
| USER user |
|
|
| |
| ENV HOME=/home/user \ |
| PATH=/home/user/.local/bin:$PATH |
|
|
| |
| WORKDIR $HOME/app |
|
|
| |
| COPY --chown=user requirements.txt . |
|
|
| |
| RUN pip3 install --no-cache-dir --user -r requirements.txt |
|
|
| |
| COPY --chown=user . $HOME/app |
|
|
| |
| RUN --mount=type=secret,id=OPENAI_API_KEY,mode=0444,required=true \ |
| bash -c 'cat /run/secrets/OPENAI_API_KEY > /tmp/OPENAI_API_KEY && echo "export OPENAI_API_KEY=$(cat /tmp/OPENAI_API_KEY)" >> ~/.bashrc' |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["bash", "-c", "source ~/.bashrc && python3 -m streamlit run app.py --server.port=7860 --server.address=0.0.0.0 --server.enableXsrfProtection=false"] |