Spaces:
Configuration error
Configuration error
| FROM python:3.11-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PORT=7860 \ | |
| FRONTEND_DIST=/home/user/app/static \ | |
| PLAYWRIGHT_BROWSERS_PATH=/ms-playwright | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential curl git nodejs npm \ | |
| libnss3 libnspr4 libdbus-1-3 libatk1.0-0 libatk-bridge2.0-0 \ | |
| libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \ | |
| libxfixes3 libxrandr2 libgbm1 libasound2 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # hf-sync copia backend/* nella root dello Space — nessun prefisso backend/ | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install --no-cache-dir -r /app/requirements.txt \ | |
| && playwright install chromium \ | |
| && chmod -R 755 /ms-playwright | |
| # S356: ttyd — terminale web per accesso da iPhone Safari (binario statico, zero dep) | |
| ARG TTYD_VERSION=1.7.7 | |
| RUN ARCH=$(uname -m) && \ | |
| TTYD_ARCH=$([ "$ARCH" = "aarch64" ] && echo "aarch64" || echo "x86_64") && \ | |
| curl -fsSL -o /usr/local/bin/ttyd \ | |
| "https://github.com/tsl0922/ttyd/releases/download/${TTYD_VERSION}/ttyd.${TTYD_ARCH}" && \ | |
| chmod +x /usr/local/bin/ttyd | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| COPY --chown=user . /home/user/app/ | |
| EXPOSE 7860 | |
| CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 1"] | |