mikonvergence commited on
Commit
ef040e1
·
verified ·
1 Parent(s): 3cd51e1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -12
Dockerfile CHANGED
@@ -1,26 +1,36 @@
1
  FROM python:3.10
2
- # 11
3
 
4
- # Set up a new user named "user" with user ID 1000 for permission
5
  RUN useradd -m -u 1000 user
6
- # Switch to the "user" user
7
- USER user
8
- # Set home to the user's home directory
9
  ENV HOME=/home/user \
10
- PATH=/home/user/.local/bin:$PATH
11
 
12
- # Upgreade pip
13
- RUN pip install --no-cache-dir --upgrade pip
 
14
 
15
- COPY --chown=user requirements.txt .
 
16
 
17
- # Install requirements
 
 
18
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
19
 
 
 
20
  ADD https://huggingface.co/datasets/mikonvergence/MajorTOM-SigLIP-Index-Viewer-App/resolve/main/siglip_ivfpq.index ./siglip_ivfpq.index
21
  ADD https://huggingface.co/datasets/mikonvergence/MajorTOM-SigLIP-Index-Viewer-App/resolve/main/siglip_ivfpq_metadata.parquet ./siglip_ivfpq_metadata.parquet
22
 
23
- COPY --chown=user *.py *.css siglip* /
24
- COPY --chown=user helpers/* /helpers/
 
 
 
 
 
 
25
 
26
  ENTRYPOINT ["solara", "run", "app.py", "--host=0.0.0.0", "--port", "7860", "--production"]
 
1
  FROM python:3.10
 
2
 
3
+ # 1. Set up a new user named "user" with user ID 1000
4
  RUN useradd -m -u 1000 user
5
+
6
+ # 2. Set home and path
 
7
  ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
 
10
+ # 3. Create a working directory (Best Practice)
11
+ # This ensures we aren't polluting the root directory
12
+ WORKDIR $HOME/app
13
 
14
+ # 4. Switch to "user" to install python packages
15
+ USER user
16
 
17
+ # Upgrade pip and install requirements
18
+ RUN pip install --no-cache-dir --upgrade pip
19
+ COPY --chown=user requirements.txt .
20
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
21
 
22
+ # 5. Download the files
23
+ # Note: ADD with URLs always saves as ROOT, regardless of the USER setting.
24
  ADD https://huggingface.co/datasets/mikonvergence/MajorTOM-SigLIP-Index-Viewer-App/resolve/main/siglip_ivfpq.index ./siglip_ivfpq.index
25
  ADD https://huggingface.co/datasets/mikonvergence/MajorTOM-SigLIP-Index-Viewer-App/resolve/main/siglip_ivfpq_metadata.parquet ./siglip_ivfpq_metadata.parquet
26
 
27
+ # 6. CRITICAL FIX: Switch to root to fix permissions, then switch back
28
+ USER root
29
+ RUN chown user:user ./siglip_ivfpq.index ./siglip_ivfpq_metadata.parquet
30
+ USER user
31
+
32
+ # 7. Copy remaining files
33
+ COPY --chown=user *.py *.css siglip* ./
34
+ COPY --chown=user helpers/* ./helpers/
35
 
36
  ENTRYPOINT ["solara", "run", "app.py", "--host=0.0.0.0", "--port", "7860", "--production"]