MajorTOM-Core-Viewer / Dockerfile
mikonvergence's picture
python-3-9-duckdb-fix (#2)
9da4646 verified
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"]