Spaces:
Running
Running
updating Dockerfile
Browse files- Dockerfile +31 -21
Dockerfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
FROM python:3.
|
2 |
|
3 |
# Install system dependencies
|
4 |
RUN apt-get update && apt-get install -y \
|
@@ -15,52 +15,58 @@ RUN apt-get update && apt-get install -y \
|
|
15 |
wget \
|
16 |
curl \
|
17 |
ninja-build \
|
|
|
|
|
18 |
&& rm -rf /var/lib/apt/lists/*
|
19 |
|
|
|
|
|
|
|
20 |
# Create user
|
21 |
RUN useradd -m -u 1000 user
|
22 |
|
23 |
WORKDIR /app
|
24 |
|
25 |
-
#
|
26 |
-
RUN pip install --upgrade pip setuptools wheel
|
27 |
|
28 |
-
# Install PyTorch
|
29 |
-
RUN pip install torch==
|
30 |
|
31 |
-
# Install numpy and pillow
|
32 |
-
RUN pip install numpy==1.
|
33 |
|
34 |
# Install detectron2 dependencies
|
35 |
RUN pip install \
|
|
|
36 |
pycocotools \
|
37 |
-
opencv-python==4.
|
38 |
-
scipy==1.
|
39 |
-
matplotlib==3.
|
40 |
-
iopath==0.1.9 \
|
41 |
-
omegaconf \
|
42 |
-
hydra-core \
|
43 |
cloudpickle \
|
44 |
tabulate \
|
45 |
tensorboard \
|
46 |
yacs \
|
47 |
termcolor \
|
48 |
future \
|
49 |
-
fvcore
|
|
|
|
|
|
|
50 |
|
51 |
-
#
|
52 |
RUN git clone https://github.com/facebookresearch/detectron2.git && \
|
53 |
cd detectron2 && \
|
54 |
git checkout v0.6 && \
|
55 |
-
pip install
|
56 |
cd ..
|
57 |
|
58 |
-
# Install
|
59 |
RUN pip install \
|
60 |
-
scikit-learn==1.
|
61 |
-
scikit-image==0.
|
62 |
-
gradio==3.
|
63 |
-
huggingface_hub==0.
|
64 |
tqdm
|
65 |
|
66 |
# Switch to user
|
@@ -78,6 +84,10 @@ RUN pip install --user --no-deps -r /app/requirements.txt || true
|
|
78 |
ENV CUDA_VISIBLE_DEVICES=""
|
79 |
ENV FORCE_CUDA="0"
|
80 |
ENV TORCH_CUDA_ARCH_LIST=""
|
|
|
|
|
|
|
|
|
81 |
|
82 |
EXPOSE 7860
|
83 |
CMD ["python", "app.py"]
|
|
|
1 |
+
FROM python:3.8-slim
|
2 |
|
3 |
# Install system dependencies
|
4 |
RUN apt-get update && apt-get install -y \
|
|
|
15 |
wget \
|
16 |
curl \
|
17 |
ninja-build \
|
18 |
+
gcc-8 \
|
19 |
+
g++-8 \
|
20 |
&& rm -rf /var/lib/apt/lists/*
|
21 |
|
22 |
+
# Set gcc-8 as default (better compatibility with detectron2)
|
23 |
+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
|
24 |
+
|
25 |
# Create user
|
26 |
RUN useradd -m -u 1000 user
|
27 |
|
28 |
WORKDIR /app
|
29 |
|
30 |
+
# Upgrade pip to a compatible version
|
31 |
+
RUN pip install --upgrade "pip<24.1" setuptools wheel
|
32 |
|
33 |
+
# Install PyTorch for Python 3.8
|
34 |
+
RUN pip install torch==1.13.1+cpu torchvision==0.14.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
35 |
|
36 |
+
# Install compatible numpy and pillow
|
37 |
+
RUN pip install numpy==1.21.6 pillow==9.5.0
|
38 |
|
39 |
# Install detectron2 dependencies
|
40 |
RUN pip install \
|
41 |
+
cython \
|
42 |
pycocotools \
|
43 |
+
opencv-python==4.5.5.64 \
|
44 |
+
scipy==1.7.3 \
|
45 |
+
matplotlib==3.5.3 \
|
|
|
|
|
|
|
46 |
cloudpickle \
|
47 |
tabulate \
|
48 |
tensorboard \
|
49 |
yacs \
|
50 |
termcolor \
|
51 |
future \
|
52 |
+
fvcore \
|
53 |
+
iopath==0.1.9 \
|
54 |
+
omegaconf==2.1.2 \
|
55 |
+
hydra-core==1.1.2
|
56 |
|
57 |
+
# Install detectron2 from source with Python 3.8 compatibility
|
58 |
RUN git clone https://github.com/facebookresearch/detectron2.git && \
|
59 |
cd detectron2 && \
|
60 |
git checkout v0.6 && \
|
61 |
+
python -m pip install -e . && \
|
62 |
cd ..
|
63 |
|
64 |
+
# Install additional dependencies
|
65 |
RUN pip install \
|
66 |
+
scikit-learn==1.0.2 \
|
67 |
+
scikit-image==0.19.3 \
|
68 |
+
gradio==3.35.2 \
|
69 |
+
huggingface_hub==0.15.1 \
|
70 |
tqdm
|
71 |
|
72 |
# Switch to user
|
|
|
84 |
ENV CUDA_VISIBLE_DEVICES=""
|
85 |
ENV FORCE_CUDA="0"
|
86 |
ENV TORCH_CUDA_ARCH_LIST=""
|
87 |
+
ENV PYTHONUNBUFFERED=1
|
88 |
+
|
89 |
+
# Create necessary directories
|
90 |
+
RUN mkdir -p /home/user/.cache
|
91 |
|
92 |
EXPOSE 7860
|
93 |
CMD ["python", "app.py"]
|