FROM nvidia/cuda:12.1.1-devel-ubuntu20.04 ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Asia/Hong_Kong RUN apt-get update && apt-get install --no-install-recommends -y tzdata python3.9 python3.9-dev python3.9-venv build-essential && \ apt-get clean && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app COPY --chown=user . $HOME/app RUN python3.9 -m venv $HOME/app/venv && $HOME/app/venv/bin/pip install --no-cache-dir --upgrade pip RUN $HOME/app/venv/bin/pip install --no-cache-dir --upgrade -r requirements.txt RUN cd $HOME/app && chmod +x $HOME/app/bin/* CMD ["/home/user/app/venv/bin/python", "app.py"]