dockerfile changes for natten
Browse files- Dockerfile +50 -51
Dockerfile
CHANGED
@@ -4,83 +4,82 @@ ENV DEBIAN_FRONTEND noninteractive
|
|
4 |
|
5 |
# Install system dependencies
|
6 |
RUN apt-get update && apt-get install -y \
|
7 |
-
git \
|
8 |
python3.8 \
|
9 |
python3.8-dev \
|
10 |
python3-pip \
|
11 |
-
|
12 |
-
build-essential \
|
13 |
-
cmake \
|
14 |
wget \
|
15 |
curl \
|
|
|
|
|
16 |
libgl1-mesa-glx \
|
17 |
libglib2.0-0 \
|
18 |
libsm6 \
|
19 |
libxext6 \
|
20 |
-
|
21 |
libgomp1 \
|
22 |
-
libgcc-7-dev \
|
23 |
&& rm -rf /var/lib/apt/lists/*
|
24 |
|
25 |
# Set python3.8 as default
|
26 |
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
|
27 |
-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
|
28 |
-
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
|
29 |
|
30 |
# Create user
|
31 |
RUN useradd -m -u 1000 user
|
32 |
WORKDIR /app
|
33 |
|
34 |
-
#
|
35 |
-
RUN python -m pip install --upgrade pip==
|
36 |
|
37 |
-
# Install PyTorch CPU
|
38 |
-
RUN pip install
|
39 |
-
torch==1.9.0+cpu \
|
40 |
-
torchvision==0.10.0+cpu \
|
41 |
-
torchaudio==0.9.0 \
|
42 |
-
-f https://download.pytorch.org/whl/torch_stable.html
|
43 |
|
44 |
-
# Install numpy
|
45 |
-
RUN pip install
|
46 |
-
numpy==1.21.6 \
|
47 |
-
Pillow==8.3.2 \
|
48 |
-
cython==0.29.35 \
|
49 |
-
pycocotools
|
50 |
|
51 |
-
#
|
52 |
-
RUN pip install
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
|
56 |
-
# Install
|
57 |
-
RUN pip install
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
scikit-learn==1.0.2 \
|
62 |
-
|
|
|
|
|
63 |
|
64 |
-
# Install
|
65 |
-
RUN pip install
|
66 |
-
gradio==3.35.2 \
|
67 |
timm==0.4.12 \
|
68 |
-
einops==0.
|
69 |
-
tqdm==4.
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
inflect==6.0.4 \
|
81 |
-
gdown==4.5.4 \
|
82 |
wget==3.2 \
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
|
85 |
# Switch to user
|
86 |
USER user
|
@@ -89,7 +88,7 @@ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
|
89 |
# Copy application
|
90 |
COPY --chown=user:user . /app
|
91 |
|
92 |
-
#
|
93 |
ENV CUDA_VISIBLE_DEVICES=""
|
94 |
ENV FORCE_CUDA="0"
|
95 |
ENV OMP_NUM_THREADS=4
|
|
|
4 |
|
5 |
# Install system dependencies
|
6 |
RUN apt-get update && apt-get install -y \
|
|
|
7 |
python3.8 \
|
8 |
python3.8-dev \
|
9 |
python3-pip \
|
10 |
+
git \
|
|
|
|
|
11 |
wget \
|
12 |
curl \
|
13 |
+
build-essential \
|
14 |
+
cmake \
|
15 |
libgl1-mesa-glx \
|
16 |
libglib2.0-0 \
|
17 |
libsm6 \
|
18 |
libxext6 \
|
19 |
+
libxrender1 \
|
20 |
libgomp1 \
|
|
|
21 |
&& rm -rf /var/lib/apt/lists/*
|
22 |
|
23 |
# Set python3.8 as default
|
24 |
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
|
25 |
+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
|
|
|
26 |
|
27 |
# Create user
|
28 |
RUN useradd -m -u 1000 user
|
29 |
WORKDIR /app
|
30 |
|
31 |
+
# Upgrade pip
|
32 |
+
RUN python -m pip install --upgrade pip==21.3.1 setuptools==59.5.0 wheel
|
33 |
|
34 |
+
# Install PyTorch CPU (specific version that works with detectron2)
|
35 |
+
RUN pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
# Install numpy first (dependency for many packages)
|
38 |
+
RUN pip install numpy==1.21.6
|
|
|
|
|
|
|
|
|
39 |
|
40 |
+
# Build and install detectron2 from source for compatibility
|
41 |
+
RUN pip install cython pybind11
|
42 |
+
RUN git clone https://github.com/facebookresearch/detectron2.git && \
|
43 |
+
cd detectron2 && \
|
44 |
+
git checkout v0.6 && \
|
45 |
+
pip install -e . && \
|
46 |
+
cd .. && \
|
47 |
+
rm -rf detectron2/.git
|
48 |
|
49 |
+
# Install core dependencies with compatible versions
|
50 |
+
RUN pip install \
|
51 |
+
Pillow==8.3.2 \
|
52 |
+
opencv-python==4.5.3.56 \
|
53 |
+
scipy==1.7.1 \
|
54 |
+
scikit-image==0.18.3 \
|
55 |
scikit-learn==1.0.2 \
|
56 |
+
h5py==3.1.0 \
|
57 |
+
shapely==1.7.1 \
|
58 |
+
imutils==0.5.4
|
59 |
|
60 |
+
# Install ML dependencies with compatible versions
|
61 |
+
RUN pip install \
|
|
|
62 |
timm==0.4.12 \
|
63 |
+
einops==0.3.2 \
|
64 |
+
tqdm==4.62.3 \
|
65 |
+
pycocotools
|
66 |
+
|
67 |
+
# Install compatible gradio and huggingface_hub
|
68 |
+
RUN pip install \
|
69 |
+
gradio==3.1.7 \
|
70 |
+
huggingface_hub==0.10.1
|
71 |
+
|
72 |
+
# Install other dependencies
|
73 |
+
RUN pip install \
|
74 |
+
gdown==4.5.1 \
|
|
|
|
|
75 |
wget==3.2 \
|
76 |
+
ftfy==6.0.3 \
|
77 |
+
regex==2021.11.10 \
|
78 |
+
inflect==5.3.0 \
|
79 |
+
submitit==1.4.1
|
80 |
+
|
81 |
+
# Optional: pytorch_lightning (skip if not needed for faster builds)
|
82 |
+
# RUN pip install pytorch_lightning==1.5.10
|
83 |
|
84 |
# Switch to user
|
85 |
USER user
|
|
|
88 |
# Copy application
|
89 |
COPY --chown=user:user . /app
|
90 |
|
91 |
+
# CPU environment variables
|
92 |
ENV CUDA_VISIBLE_DEVICES=""
|
93 |
ENV FORCE_CUDA="0"
|
94 |
ENV OMP_NUM_THREADS=4
|