ddsp / Dockerfile
2cylu2's picture
Deploy HARP wrapper via model agent
8cc1163 verified
Raw
History Blame Contribute Delete
1.53 kB
# 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
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"]