# Use the specific COCO version as the base FROM infinilabs/coco:0.10.0-2678 # Switch to root to install system packages USER root # Install Python, pip, venv, curl, and git RUN apt-get update && apt-get install -y \ python3 \ python3-pip \ python3-venv \ curl \ git \ && rm -rf /var/lib/apt/lists/* # Set up the non-root user for Hugging Face (UID 1000) RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Create app directory and set permissions WORKDIR /app/easysearch RUN mkdir -p data config logs && chown -R user:user /app/easysearch # Copy your local files (server.py, requirements.txt, start.sh) COPY --chown=user:user . . # Switch to the non-root user USER user # Set up Python virtual environment and install dependencies # Note: You can also run 'pip install -r requirements.txt' directly if preferred RUN python3 -m venv /home/user/venv ENV PATH="/home/user/venv/bin:$PATH" # Example of manual pip installation (Commented as requested) # RUN pip install numpy pandas requests # Install your requirements if the file exists RUN if [ -f reqs.txt ]; then pip install --no-cache-dir -r reqs.txt; fi # Grant execution rights to the startup script RUN chmod +x start.sh # Expose both ports (7860 for HF Space, 9000 for COCO) EXPOSE 7860 EXPOSE 9000 # Launch the services via the shell script CMD ["./start.sh"]