FROM python:3.11-slim RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ espeak-ng \ libsndfile1 \ nginx \ curl \ build-essential \ && curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ && apt-get install -y nodejs \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 WORKDIR /home/user/app RUN pip install --upgrade pip setuptools wheel RUN pip install --no-cache-dir \ torch==2.2.2 \ torchvision==0.17.2 \ --index-url https://download.pytorch.org/whl/cpu COPY --chown=user backend/requirements_hf.txt ./ RUN pip install --user --no-cache-dir -r requirements_hf.txt COPY --chown=user frontend/package.json ./frontend/ RUN cd frontend && npm install --legacy-peer-deps --silent COPY --chown=user frontend/ ./frontend/ RUN cd frontend && npm run build COPY --chown=user backend/ ./backend/ COPY --chown=user nginx_hf.conf /home/user/nginx.conf COPY --chown=user start.sh ./ RUN chmod +x start.sh RUN mkdir -p \ /home/user/app/backend/data/faiss_index \ /home/user/app/backend/uploads \ /home/user/tmp/client_body \ /home/user/tmp/proxy \ /home/user/tmp/fastcgi USER user EXPOSE 7860 CMD ["./start.sh"]