FROM nvidia/cuda:12.2.0-base-ubuntu20.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update \ && apt-get install \ curl wget python3.10 \ python3.10-distutils \ python3-pip \ curl wget -y \ && rm -rf /var/lib/apt/lists/* # FastAPI section # device env ENV DEVICE="cuda" # Copy and install requirements.txt COPY ./gpu-requirements.txt ./requirements.txt COPY ./src /app COPY ./scripts/start.sh /start.sh COPY ./scripts/gunicorn_conf.py /gunicorn_conf.py COPY ./scripts/start-reload.sh /start-reload.sh COPY ./scripts/prestart.sh /app COPY ./VERSION / RUN mkdir -p /app/resources/model \ && pip install --upgrade --no-cache-dir -r requirements.txt \ && chmod +x /start.sh \ && chmod +x /start-reload.sh ARG MODEL_NAME_OR_PATH WORKDIR /app ENV PYTHONPATH=/app EXPOSE 80 # Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Gunicorn with Uvicorn CMD ["/start.sh"]