FROM mcr.microsoft.com/playwright/python:v1.49.0-jammy

WORKDIR /app

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    TELEGRAM_LISTEN_HOST=0.0.0.0 \
    TELEGRAM_LISTEN_PORT=8090

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

RUN mkdir -p /app/chrome-profile /app/data

EXPOSE 8090

# Host/port из env (на сервере host-network + TELEGRAM_LISTEN_PORT=8121).
CMD ["sh", "-c", "exec uvicorn server:app --host \"${TELEGRAM_LISTEN_HOST:-0.0.0.0}\" --port \"${TELEGRAM_LISTEN_PORT:-8090}\""]
