# ───────────────────────────────────────────────────────────────── # Group 07 — I-ILIA-014 MIR Project • Dockerfile (HF Spaces) # # Architecture: # • Data decoupled from Space repo: downloaded from separate Dataset repo # • Archives extracted at build time into /home/user/app/ # • Port 7860 (HF Spaces default) # • UID 1000 user "user" (HF Spaces convention) # • Layer caching: data layer cached across code-only rebuilds # ───────────────────────────────────────────────────────────────── FROM python:3.11-slim RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" WORKDIR /home/user/app # Layer 1: install huggingface_hub to run the download script RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir "huggingface_hub>=0.23" # Layer 2: download and extract data — cached across code-only rebuilds COPY --chown=user download_data.py . RUN python download_data.py # Layer 3: install app dependencies COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Layer 4: copy app code — only this layer rebuilds on code changes COPY --chown=user . . ENV MIR_H5_DIR=/home/user/app/descriptors/CLIP_Flickr8k \ MIR_MAX_BACKBONES=4 \ MIR_DEFAULT_BACKBONE=clip EXPOSE 7860 CMD ["gunicorn", "--chdir", "/home/user/app/Interface", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "300", "app:app"]