Spaces:
Sleeping
Sleeping
File size: 1,837 Bytes
ebb7462 90b25f5 ebb7462 90b25f5 ef040e1 ebb7462 90b25f5 ebb7462 90b25f5 ebb7462 90b25f5 ebb7462 90b25f5 ebb7462 90b25f5 ebb7462 efda56f ebb7462 ef040e1 ebb7462 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 37 38 39 40 41 42 43 44 45 |
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"] |