forked from Eshe/competition-vd
51 lines
1.6 KiB
Plaintext
Executable File
51 lines
1.6 KiB
Plaintext
Executable File
FROM nvcr.io/nvidia/tensorrt:21.12-py3
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV PATH="/opt/conda/bin:${PATH}"
|
|
ARG PATH="/opt/conda/bin:${PATH}"
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
wget \
|
|
git \
|
|
build-essential \
|
|
libpq-dev \
|
|
postgresql \
|
|
redis-server \
|
|
libsm6 \
|
|
libxext6 \
|
|
libxrender-dev \
|
|
libglib2.0-0 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh \
|
|
&& bash Mambaforge-Linux-x86_64.sh -b -p /opt/conda \
|
|
&& rm -f Mambaforge-Linux-x86_64.sh
|
|
|
|
RUN mamba create -n ml_env python=3.9 -y
|
|
ENV PATH /opt/conda/envs/ml_env/bin:$PATH
|
|
SHELL ["conda", "run", "-n", "ml_env", "/bin/bash", "-c"]
|
|
|
|
COPY requirements.txt /tmp/
|
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
|
|
|
RUN mamba install -c pytorch -c nvidia pytorch torchvision torchaudio cudatoolkit=11.3 -y
|
|
RUN mamba install -c conda-forge opencv -y
|
|
|
|
RUN git clone https://github.com/NVIDIA/apex
|
|
RUN cd apex && pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
|
|
|
|
WORKDIR /app
|
|
COPY . /app
|
|
|
|
RUN pip install --no-cache-dir dlib
|
|
|
|
RUN adduser --disabled-password --gecos '' myuser
|
|
USER myuser
|
|
|
|
RUN mkdir -p /home/myuser/.config/matplotlib
|
|
RUN echo "backend : Agg" > /home/myuser/.config/matplotlib/matplotlibrc
|
|
|
|
ENV PYTHONPATH "${PYTHONPATH}:/app"
|
|
ENV LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
|
|
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "--threads", "4", "--timeout", "120", "app:server"] |