mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2026-11-20 22:16:33 +00:00
- Migrate from daijro/camoufox==0.4.* to cloverlabs-camoufox==0.6.* (drop-in API: same import path, same kwargs) - Pin playwright>=1.58,<1.61 to prevent protocol error (Browser.setDefaultViewport viewport.isMobile incompatibility with camoufox bundled Firefox v135.0.1-beta.24; upstream daijro/camoufox#653) - Bump fastapi 0.136->0.139, pytest 9.0->9.1, pytest-asyncio 1.3->1.4 (absorbs Renovate PRs #360, #359, #357) - Remove dead deptry DEP002 pyautogui ignore (cloverlabs dropped pyautogui) - Add tini to Dockerfile base image and set as ENTRYPOINT PID 1 (fixes zombie/defunct Firefox subprocesses: [Socket Process], [RDD Process], [Utility Process] — verified: 21 zombies without tini, 0 zombies with tini after 5 POST /v1 requests) - Remove init: true from compose.yaml (tini makes it redundant) - Remove --init/init: true checkbox from bug report template Closes #339, #340, #360, #359, #357, #366
64 lines
1.8 KiB
Docker
64 lines
1.8 KiB
Docker
# Ubuntu is required by playwright.
|
|
# Pin to 24.04 LTS: ubuntu:latest floats to 26.04, which Playwright 1.58
|
|
# cannot install firefox deps for (no libgtk-3 -> camoufox fails to launch).
|
|
FROM ubuntu:24.04 AS base
|
|
|
|
ARG GITHUB_BUILD=false \
|
|
VERSION
|
|
|
|
ENV GITHUB_BUILD=${GITHUB_BUILD}\
|
|
VERSION=${VERSION}\
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
PYTHONUNBUFFERED=1 \
|
|
# prevents python creating .pyc files
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
UV_LINK_MODE=copy \
|
|
PORT=8191 \
|
|
XDG_CACHE_HOME=/cache \
|
|
HOME=/tmp
|
|
|
|
RUN apt-get update &&\
|
|
apt-get install -y --no-install-recommends curl ca-certificates tini &&\
|
|
apt-get clean &&\
|
|
rm -rf /var/lib/apt/lists/*
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
|
|
|
FROM base AS devcontainer
|
|
RUN apt-get update &&\
|
|
apt-get install -y --no-install-recommends git &&\
|
|
uvx playwright install-deps firefox &&\
|
|
uvx camoufox fetch &&\
|
|
apt-get clean &&\
|
|
rm -rf /var/lib/apt/lists/*
|
|
ENTRYPOINT [ "sleep", "infinity" ]
|
|
|
|
FROM base AS app
|
|
WORKDIR /app
|
|
|
|
COPY pyproject.toml uv.lock ./
|
|
RUN mkdir -p /cache &&\
|
|
uv sync &&\
|
|
uv run camoufox fetch &&\
|
|
apt-get update &&\
|
|
uv run playwright install-deps firefox &&\
|
|
uv cache clean &&\
|
|
apt-get clean &&\
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY . .
|
|
|
|
# Make app and cache world-readable; addon scripts dir world-writable (runtime writes)
|
|
RUN chmod -R o+rX /app /cache &&\
|
|
find /app/.venv -path "*/camoufox_add_init_script/addon" -type d -exec chmod -R o+rwX {} +
|
|
|
|
FROM app AS test
|
|
RUN \
|
|
uv sync --group test &&\
|
|
uv run pytest --retries 3
|
|
|
|
FROM app
|
|
USER 1000
|
|
EXPOSE $PORT
|
|
HEALTHCHECK --interval=15m --timeout=30s --start-period=5s --retries=3 CMD curl "http://localhost:${PORT}/health"
|
|
ENTRYPOINT ["tini", "--", "/app/.venv/bin/python", "main.py"]
|