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