lolout1 commited on
Commit
0361d96
·
1 Parent(s): 25b5a41

Docker file changes

Browse files
Files changed (1) hide show
  1. Dockerfile +1 -59
Dockerfile CHANGED
@@ -1,54 +1,5 @@
1
  FROM python:3.10
2
 
3
- # Set up user to avoid permission issues
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV HOME=/home/user \
7
- PATH=/home/user/.local/bin:$PATH
8
-
9
- WORKDIR $HOME/app
10
-
11
- # Switch to root to install system packages
12
- USER root
13
-
14
- # Install ALL necessary system dependencies for OpenCV and GUI libraries
15
- RUN apt-get update && apt-get install -y \
16
- git \
17
- build-essential \
18
- cmake \
19
- python3-dev \
20
- # OpenCV dependencies
21
- libglib2.0-0 \
22
- libsm6 \
23
- libxext6 \
24
- libxrender-dev \
25
- libgomp1 \
26
- libglib2.0-0 \
27
- libgl1-mesa-glx \
28
- libglib2.0-0 \
29
- libgtk2.0-dev \
30
- # Additional useful libraries
31
- wget \
32
- unzip \
33
- ffmpeg \
34
- libopencv-dev \
35
- && rm -rf /var/lib/apt/lists/*
36
-
37
- # Switch back to user
38
- USER user
39
-
40
- # Copy requirements first (for better caching)
41
- COPY --chown=user:user requirements.txt .
42
-
43
- # Install Python dependencies
44
- RUN pip install --user --no-cache-dir --upgrade pip && \
45
- pip install --user --no-cache-dir torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cpu && \
46
- pip install --user --no-cache-dir -r requirements.txt
47
-
48
- # Install detectron2 separately after torch is installed
49
- RUN git clone https://github.com/facebookresearch/detectron2 $HOME/app/detectron2 && \
50
- pip install --user -FROM python:3.10
51
-
52
  # Install system dependencies
53
  RUN apt-get update && apt-get install -y \
54
  git \
@@ -71,7 +22,7 @@ RUN apt-get update && apt-get install -y \
71
  # Set up user
72
  RUN useradd -m -u 1000 user
73
 
74
- # Install PyTorch as root (system-wide)
75
  RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu torchaudio==2.0.2+cpu --index-url https://download.pytorch.org/whl/cpu
76
 
77
  # Clone and install detectron2 as root (without -e flag)
@@ -92,13 +43,4 @@ RUN pip install --user --no-cache-dir -r requirements.txt
92
  COPY --chown=user:user . .
93
 
94
  EXPOSE 7860
95
- CMD ["python", "app.py"]e $HOME/app/detectron2
96
-
97
- # Copy app files
98
- COPY --chown=user:user . .
99
-
100
- # Expose port for Gradio
101
- EXPOSE 7860
102
-
103
- # Run the application
104
  CMD ["python", "app.py"]
 
1
  FROM python:3.10
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  git \
 
22
  # Set up user
23
  RUN useradd -m -u 1000 user
24
 
25
+ # Install PyTorch CPU version as root (system-wide)
26
  RUN pip install torch==2.0.1+cpu torchvision==0.15.2+cpu torchaudio==2.0.2+cpu --index-url https://download.pytorch.org/whl/cpu
27
 
28
  # Clone and install detectron2 as root (without -e flag)
 
43
  COPY --chown=user:user . .
44
 
45
  EXPOSE 7860
 
 
 
 
 
 
 
 
 
46
  CMD ["python", "app.py"]