FROM continuumio/miniconda3 # 1. Set up a new user RUN useradd -m -u 1000 user # 2. Set Environment Variables # KEY CONDA TRICK: Add the new environment's bin to PATH immediately. # This prevents the need for "conda activate" or "source activate" later. ENV HOME=/home/user \ PATH=/opt/conda/envs/app_env/bin:$PATH # 3. Set Working Directory WORKDIR /home/user/app # 4. Create the Conda Environment # We install python 3.9 and wget (to handle downloads cleanly) # We do this as root to ensure it installs correctly in /opt/conda RUN conda create -n app_env python=3.9 wget -y # 5. Install Requirements # Since we updated PATH in step 2, this 'pip' runs inside our conda env. COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # 6. Fix Directory Permissions # Give the user ownership of the app folder before switching users RUN chown -R user:user /home/user/app # 7. Switch to "user" USER user # 8. Download the files # We use wget (installed via conda) instead of ADD. # Because we are "USER user", these files are automatically owned by user. # This removes the need for the complex "ADD -> Switch to Root -> Chown -> Switch Back" dance. RUN wget https://huggingface.co/datasets/mikonvergence/MajorTOM-SigLIP-Index-Viewer-App/resolve/main/siglip_ivfpq.index -O siglip_ivfpq.index && \ wget https://huggingface.co/datasets/mikonvergence/MajorTOM-SigLIP-Index-Viewer-App/resolve/main/siglip_ivfpq_metadata.parquet -O siglip_ivfpq_metadata.parquet # 9. Copy remaining files # We removed 'siglip*' from here so we don't accidentally overwrite the downloaded files with local versions. COPY --chown=user *.py *.css ./ COPY --chown=user helpers/* ./helpers/ ENTRYPOINT ["solara", "run", "app.py", "--host=0.0.0.0", "--port", "7860", "--production"]