File size: 1,733 Bytes
f7dc259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b41873a
f7dc259
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225cd88
 
f391898
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225cd88
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    git-lfs \
    python3 \
    python3-pip \
    python3-setuptools \
    python3-wheel \
    python3-dev \
    cmake \
    unzip \
    vim \
    ffmpeg \
    curl \
    wget \
    libgl1-mesa-glx \
    libglib2.0-0 \
    build-essential \
    libsparsehash-dev \
    && rm -rf /var/lib/apt/lists/*

# Set Python3 as the default version
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1

RUN pip3 install --upgrade pip

# Install PyTorch
RUN pip3 install --no-cache-dir \
    torch \
    torchvision \
    torchaudio \
    --index-url https://download.pytorch.org/whl/cu118

COPY requirements.txt /opt/app/requirements.txt
WORKDIR /opt/app
RUN pip install -r requirements.txt
# COPY . /opt/app
COPY requirements.txt /opt/app

ARG TORCH_CUDA_ARCH_LIST="5.2;7.0;7.2;8.0;8.6+PTX"
ARG IABN_FORCE_CUDA="1"
ARG FORCE_CUDA="1"
RUN pip3 install --no-cache-dir \
    inplace_abn \
    git+https://github.com/mit-han-lab/[email protected]


# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH \
    PYTHONPATH=$HOME/app \
	PYTHONUNBUFFERED=1 \
	SYSTEM=spaces
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app


CMD ["python3", "app.py"]