19 lines
904 B
Docker
19 lines
904 B
Docker
FROM mcr.microsoft.com/playwright/python:v1.65.2-noble@sha256:38dd67fc654b56b3cba611e4c8eb71cd33750e1cd29eea2a5dc00b484817a75f
|
|
|
|
WORKDIR /app
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY guard.py pagecheck.py protocol.py llm.py egress.py runner.py server.py ./
|
|
|
|
# pwuser comes with the image; the browser never runs as root
|
|
USER pwuser
|
|
ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/health')"
|
|
|
|
# one worker: cases run one after the other (LOCK in server.py), each with a fresh browser; a case may take
|
|
# 5 minutes. The second thread answers /health meanwhile, so the container is not reported unhealthy.
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "1", "--threads", "2", "--timeout", "420", "server:app"]
|