File size: 966 Bytes
626eca0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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"]