FROM nvidia/cuda:11.3.1-base-ubuntu20.04
ENV DEBIAN_FRONTEND=noninteractive

#Install core packages
RUN apt-get update && apt-get install -y \
      libncurses5 python3 python3-pip curl git apt-utils ssh ca-certificates \
      tmux nano vim sudo bash rsync htop wget unzip python3.8-venv \
      python3-virtualenv python3-distutils python3-numpy tini && \
    update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
    update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 && \
    pip3 install --no-cache-dir --upgrade pip

#Install Python deps
RUN pip3 install --no-cache-dir dotmap icecream sentry-sdk numpy fastapi "uvicorn[standard]" gunicorn https://github.com/pesser/stable-diffusion/archive/d878c53f131f60a3518acaeb0a1b1095a3689c94.zip
RUN pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

#Open ports
EXPOSE 8080
EXPOSE 80
EXPOSE 443
EXPOSE 4369
EXPOSE 5672
EXPOSE 25672
EXPOSE 15672
EXPOSE 15692
EXPOSE 50051
#Copy node src and run
WORKDIR /usr/src/app
COPY . .

RUN pip3 install omegaconf
CMD [ "gunicorn", "main:app", "--workers=1", "--worker-class=uvicorn.workers.UvicornWorker". "--bind=0.0.0.0:80" ]