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

Docker file root user changes

Browse files
Files changed (1) hide show
  1. Dockerfile +46 -1
Dockerfile CHANGED
@@ -47,7 +47,52 @@ RUN pip install --user --no-cache-dir --upgrade pip && \
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 -e $HOME/app/detectron2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  # Copy app files
53
  COPY --chown=user:user . .
 
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 \
55
+ build-essential \
56
+ cmake \
57
+ python3-dev \
58
+ libglib2.0-0 \
59
+ libsm6 \
60
+ libxext6 \
61
+ libxrender-dev \
62
+ libgomp1 \
63
+ libgl1-mesa-glx \
64
+ libgtk2.0-dev \
65
+ wget \
66
+ unzip \
67
+ ffmpeg \
68
+ libopencv-dev \
69
+ && rm -rf /var/lib/apt/lists/*
70
+
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)
78
+ RUN git clone https://github.com/facebookresearch/detectron2 /tmp/detectron2 && \
79
+ cd /tmp/detectron2 && \
80
+ pip install .
81
+
82
+ # Switch to user
83
+ USER user
84
+ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
85
+ WORKDIR $HOME/app
86
+
87
+ # Copy and install other requirements
88
+ COPY --chown=user:user requirements.txt .
89
+ RUN pip install --user --no-cache-dir -r requirements.txt
90
+
91
+ # Copy app files
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 . .