# HARP dual-interpreter Space: pyharp/Gradio frontend (Python 3.10) + # isolated model backend (Python 3.9) via one-shot subprocess IPC. FROM python:3.10-slim-bullseye ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ PYTHONIOENCODING=UTF-8 \ FRONTEND_VENV=/opt/frontend \ BACKEND_VENV=/opt/backend \ BACKEND_PYTHON=/opt/backend/bin/python \ BACKEND_SCRIPT=/app/backend_worker.py \ PORT=7860 # Debian 11 is end-of-life, so its packages now live on archive.debian.org. # Point apt there before the first update, and accept the stale Release files. RUN set -eux; \ printf 'deb http://archive.debian.org/debian bullseye main\ndeb http://archive.debian.org/debian-security bullseye-security main\n' \ > /etc/apt/sources.list; \ rm -f /etc/apt/sources.list.d/*.list; \ printf 'Acquire::Check-Valid-Until "false";\n' > /etc/apt/apt.conf.d/99no-check-valid-until RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ git \ python3.9 \ python3.9-dev \ python3.9-venv \ python3.9-distutils \ libsndfile1 \ libsndfile-dev \ ffmpeg \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY requirements-backend.txt /tmp/requirements-backend.txt RUN /usr/bin/python3.9 -m venv "$BACKEND_VENV" \ && printf 'setuptools<81\nwheel\n' > /tmp/backend-build-constraints.txt \ && "$BACKEND_VENV/bin/pip" install --no-cache-dir -U pip wheel "setuptools<81" \ && PIP_CONSTRAINT=/tmp/backend-build-constraints.txt "$BACKEND_VENV/bin/pip" install --no-cache-dir -r /tmp/requirements-backend.txt COPY requirements-frontend.txt /tmp/requirements-frontend.txt RUN /usr/local/bin/python3.10 -m venv "$FRONTEND_VENV" \ && "$FRONTEND_VENV/bin/pip" install --no-cache-dir -U pip wheel \ && "$FRONTEND_VENV/bin/pip" install --no-cache-dir -r /tmp/requirements-frontend.txt COPY backend_worker.py frontend_app.py start.sh ./ RUN chmod +x /app/start.sh EXPOSE 7860 CMD ["/app/start.sh"]