mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-09-24 22:05:20 +01:00
Bumps the docker-base-image-digests group with 1 update: [astral-sh/uv](https://github.com/astral-sh/uv). Updates `astral-sh/uv` from 0.11.3 to 0.12.5 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/uv/releases">astral-sh/uv's releases</a>.</em></p> <blockquote> <h2>0.12.5</h2> <h2>Release Notes</h2> <p>Released on 2026-08-14.</p> <h3>Python</h3> <ul> <li>Add CPython 3.10.21, 3.11.16, and 3.12.14 (<a href="https://redirect.github.com/astral-sh/uv/pull/21138">#21138</a>)</li> <li>Prefer newer versions and standard variants when selecting between equally prioritized Python interpreters (<a href="https://redirect.github.com/astral-sh/uv/pull/21134">#21134</a>)</li> </ul> <h3>Enhancements</h3> <ul> <li>Simplify errors and hints for invalid editable requirements, and redact credentials in requirement URLs (<a href="https://redirect.github.com/astral-sh/uv/pull/21130">#21130</a>)</li> </ul> <h3>Preview features</h3> <ul> <li>Allow <code>--index</code> and <code>--default-index</code> to select configured package indexes by name with the <code>index-by-name</code> preview feature (<a href="https://redirect.github.com/astral-sh/uv/pull/17455">#17455</a>)</li> <li>Include distribution artifact URLs and hashes in CycloneDX SBOM exports by default (<a href="https://redirect.github.com/astral-sh/uv/pull/21131">#21131</a>)</li> <li>Fall back to logical file sizes when using <code>cache-physical-space</code> on filesystems that do not support physical-space accounting (<a href="https://redirect.github.com/astral-sh/uv/pull/21133">#21133</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Resolve relative package index paths in PEP 723 scripts against the script directory (<a href="https://redirect.github.com/astral-sh/uv/pull/21097">#21097</a>)</li> </ul> <h2>Install uv 0.12.5</h2> <h3>Install prebuilt binaries via shell script</h3> <pre lang="sh"><code>curl --proto '=https' --tlsv1.2 -LsSf https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-installer.sh | sh </code></pre> <h3>Install prebuilt binaries via powershell script</h3> <pre lang="sh"><code>powershell -ExecutionPolicy Bypass -c "irm https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-installer.ps1 | iex" </code></pre> <h2>Download uv 0.12.5</h2> <table> <thead> <tr> <th>File</th> <th>Platform</th> <th>Checksum</th> </tr> </thead> <tbody> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-aarch64-apple-darwin.tar.gz">uv-aarch64-apple-darwin.tar.gz</a></td> <td>Apple Silicon macOS</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-aarch64-apple-darwin.tar.gz.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-x86_64-apple-darwin.tar.gz">uv-x86_64-apple-darwin.tar.gz</a></td> <td>Intel macOS</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-x86_64-apple-darwin.tar.gz.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-aarch64-pc-windows-msvc.zip">uv-aarch64-pc-windows-msvc.zip</a></td> <td>ARM64 Windows</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-aarch64-pc-windows-msvc.zip.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-i686-pc-windows-msvc.zip">uv-i686-pc-windows-msvc.zip</a></td> <td>x86 Windows</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-i686-pc-windows-msvc.zip.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-x86_64-pc-windows-msvc.zip">uv-x86_64-pc-windows-msvc.zip</a></td> <td>x64 Windows</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-x86_64-pc-windows-msvc.zip.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-aarch64-unknown-linux-gnu.tar.gz">uv-aarch64-unknown-linux-gnu.tar.gz</a></td> <td>ARM64 Linux</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-aarch64-unknown-linux-gnu.tar.gz.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-i686-unknown-linux-gnu.tar.gz">uv-i686-unknown-linux-gnu.tar.gz</a></td> <td>x86 Linux</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-i686-unknown-linux-gnu.tar.gz.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-powerpc64le-unknown-linux-gnu.tar.gz">uv-powerpc64le-unknown-linux-gnu.tar.gz</a></td> <td>PPC64LE Linux</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.12.5/uv-powerpc64le-unknown-linux-gnu.tar.gz.sha256">checksum</a></td> </tr> </tbody> </table> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/astral-sh/uv/blob/main/CHANGELOG.md">astral-sh/uv's changelog</a>.</em></p> <blockquote> <h2>0.12.5</h2> <p>Released on 2026-08-14.</p> <h3>Python</h3> <ul> <li>Add CPython 3.10.21, 3.11.16, and 3.12.14 (<a href="https://redirect.github.com/astral-sh/uv/pull/21138">#21138</a>)</li> <li>Prefer newer versions and standard variants when selecting between equally prioritized Python interpreters (<a href="https://redirect.github.com/astral-sh/uv/pull/21134">#21134</a>)</li> </ul> <h3>Enhancements</h3> <ul> <li>Simplify errors and hints for invalid editable requirements, and redact credentials in requirement URLs (<a href="https://redirect.github.com/astral-sh/uv/pull/21130">#21130</a>)</li> </ul> <h3>Preview features</h3> <ul> <li>Allow <code>--index</code> and <code>--default-index</code> to select configured package indexes by name with the <code>index-by-name</code> preview feature (<a href="https://redirect.github.com/astral-sh/uv/pull/17455">#17455</a>)</li> <li>Include distribution artifact URLs and hashes in CycloneDX SBOM exports by default (<a href="https://redirect.github.com/astral-sh/uv/pull/21131">#21131</a>)</li> <li>Fall back to logical file sizes when using <code>cache-physical-space</code> on filesystems that do not support physical-space accounting (<a href="https://redirect.github.com/astral-sh/uv/pull/21133">#21133</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Resolve relative package index paths in PEP 723 scripts against the script directory (<a href="https://redirect.github.com/astral-sh/uv/pull/21097">#21097</a>)</li> </ul> <h2>0.12.4</h2> <p>Released on 2026-08-13.</p> <h3>Enhancements</h3> <ul> <li>Prefer post-quantum key exchange and enable opt-in TLS diagnostics (<a href="https://redirect.github.com/astral-sh/uv/pull/21054">#21054</a>)</li> <li>Accept whitespace before versions in noncompliant wildcard comparisons such as <code>Requires-Python: >= 3.5.*</code> (<a href="https://redirect.github.com/astral-sh/uv/pull/21012">#21012</a>)</li> <li>Report a specific error when a PEP 723 closing tag contains trailing whitespace or other content (<a href="https://redirect.github.com/astral-sh/uv/pull/20944">#20944</a>)</li> <li>Omit source-span carets from diagnostics for empty PEP 508 requirements (<a href="https://redirect.github.com/astral-sh/uv/pull/21094">#21094</a>)</li> </ul> <h3>Preview features</h3> <ul> <li>Add <code>uv check --no-install-project</code> and respect <code>UV_NO_INSTALL_PROJECT</code> to install dependencies without building or installing the project (<a href="https://redirect.github.com/astral-sh/uv/pull/21085">#21085</a>)</li> <li>Make the ty subprocess invoked by <code>uv check</code> honor uv's color and progress settings, including quiet mode (<a href="https://redirect.github.com/astral-sh/uv/pull/21086">#21086</a>)</li> </ul> <h3>Performance</h3> <ul> <li>Speed up resolutions with long runs of unavailable package versions by coalescing gaps in the resolver's version ranges (<a href="https://redirect.github.com/astral-sh/uv/pull/20804">#20804</a>)</li> <li>Speed up Simple API parsing by deserializing PyPI and Pyx file metadata directly (<a href="https://redirect.github.com/astral-sh/uv/pull/21041">#21041</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Use windowed <code>pythonw.exe</code> launchers for virtual environments created from managed Python minor-version links (<a href="https://redirect.github.com/astral-sh/uv/pull/19235">#19235</a>)</li> <li>Allow <code>uv lock</code> to proceed when <code>.venv</code> is an unusable project environment (<a href="https://redirect.github.com/astral-sh/uv/pull/21068">#21068</a>)</li> <li>Respect <code>fork-strategy</code> when ordering forks created from <code>environments</code> or existing lockfile <code>resolution-markers</code> (<a href="https://redirect.github.com/astral-sh/uv/pull/21000">#21000</a>)</li> <li>Preserve consecutive wildcard Python minor-version exclusions such as <code>!=3.11.*, !=3.12.*</code> in <code>uv.lock</code> (<a href="https://redirect.github.com/astral-sh/uv/pull/21045">#21045</a>)</li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/uv/commit/210d1f6785e95a8c8c0d53e284408c9be1134700"><code>210d1f6</code></a> Bump version to 0.12.5 (<a href="https://redirect.github.com/astral-sh/uv/issues/21140">#21140</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/802a9162a1153ddee799a0080c80a38d96009d91"><code>802a916</code></a> Sync latest Python releases: 3.10.21, 3.11.16, 3.12.14 (<a href="https://redirect.github.com/astral-sh/uv/issues/21138">#21138</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/a6904bbdabd3c6ac42b1051896ff597c8bd1895a"><code>a6904bb</code></a> Order equal-priority Python installations by key (<a href="https://redirect.github.com/astral-sh/uv/issues/21134">#21134</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/728a70d25c0889d9aaa53776256c3a843eea67a6"><code>728a70d</code></a> Improve automated fixes for related bug manifestations (<a href="https://redirect.github.com/astral-sh/uv/issues/21102">#21102</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/b82b0383fc3471227aa864f18d2c1c8efac8b9f1"><code>b82b038</code></a> Include hashes in cyclonedx exports (<a href="https://redirect.github.com/astral-sh/uv/issues/21131">#21131</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/8011778d41f2c96fb0b856fb3cbcb4ec8d28cb63"><code>8011778</code></a> Simplify editable requirement errors and hints (<a href="https://redirect.github.com/astral-sh/uv/issues/21130">#21130</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/dca33f5e6799f2aefee52729732a839a3b358740"><code>dca33f5</code></a> Fall back to logical cache accounting on unsupported filesystems (<a href="https://redirect.github.com/astral-sh/uv/issues/21133">#21133</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/3a76e496e36783371a6d91a8f4834478964d36ca"><code>3a76e49</code></a> Get rid of <code>Lock::with_manifest</code>, make <code>Lock::from_resolution</code> take the manif...</li> <li><a href="https://github.com/astral-sh/uv/commit/7e6caa45f62a0506fea1b8ecfa0558e5d62d520c"><code>7e6caa4</code></a> Support referencing indexes by name via <code>--index</code> and <code>--default-index</code> (<a href="https://redirect.github.com/astral-sh/uv/issues/17455">#17455</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/298dda41bff49bbd0a2f397e1662ab09b9cd148e"><code>298dda4</code></a> Fix relative indexes in PEP 723 scripts (<a href="https://redirect.github.com/astral-sh/uv/issues/21097">#21097</a>)</li> <li>Additional commits viewable in <a href="https://github.com/astral-sh/uv/compare/0.11.3...0.12.5">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
248 lines
10 KiB
Docker
248 lines
10 KiB
Docker
ARG TARGETPLATFORM
|
|
ARG TARGETARCH
|
|
ARG BUILDPLATFORM
|
|
ARG BUILDARCH
|
|
|
|
# Frontend build stage.
|
|
FROM --platform=$BUILDPLATFORM node:24-alpine@sha256:d32cdf619f63fe0471182d08996dd516c6275bb5fd31ae06e55a570bd9e1ad43 AS frontend-builder
|
|
|
|
# Helpful debug output to see what platforms BuildKit thinks it's using
|
|
RUN echo "BUILDPLATFORM=$BUILDPLATFORM BUILDARCH=$BUILDARCH TARGETPLATFORM=$TARGETPLATFORM TARGETARCH=$TARGETARCH"
|
|
|
|
WORKDIR /frontend
|
|
|
|
# Copy frontend package files
|
|
COPY src/frontend/package*.json ./
|
|
|
|
# Install dependencies (cache mount for faster rebuilds)
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm ci
|
|
|
|
# Copy frontend source
|
|
COPY src/frontend/ ./
|
|
|
|
# Build the frontend
|
|
RUN npm run build
|
|
|
|
# uv is a build-time tool only, so it is mounted into the RUNs that need it rather
|
|
# than copied into the image. A COPY here would land ~24 MB in a `base` layer that
|
|
# every published image inherits, and a later `rm` cannot take it back out again --
|
|
# a RUN adds a layer, it does not rewrite the one underneath.
|
|
FROM ghcr.io/astral-sh/uv:0.12.5@sha256:e85be844203885286c60ffad8a858d48afb6c5a5c237ca0e67f12e74b8f174b1 AS uv
|
|
|
|
# Use python-slim as the base image
|
|
FROM python:3.14.7-slim@sha256:ce40764625a4ff50df3548277632e7f96c4e77fe75fa848aae9885476e7df5a4 AS base
|
|
|
|
# Add build argument for version
|
|
ARG BUILD_VERSION
|
|
ENV BUILD_VERSION=${BUILD_VERSION}
|
|
ARG RELEASE_VERSION
|
|
ENV RELEASE_VERSION=${RELEASE_VERSION}
|
|
|
|
# Set shell to bash with pipefail option
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
|
|
# Consistent environment variables grouped together
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
DOCKERMODE=true \
|
|
UV_LINK_MODE=copy \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONIOENCODING=UTF-8 \
|
|
NAME=Shelfmark \
|
|
PATH=/app/.venv/bin:$PATH \
|
|
PYTHONPATH=/app \
|
|
# PUID/PGID will be handled by entrypoint script, but TZ/Locale are still needed
|
|
LANG=en_US.UTF-8 \
|
|
LANGUAGE=en_US:en \
|
|
LC_ALL=en_US.UTF-8
|
|
|
|
# Set ARG for build-time expansion (FLASK_PORT), ENV for runtime access
|
|
ENV FLASK_PORT=8084
|
|
|
|
# Configure locale, timezone, and perform initial cleanup in a single layer
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
# For building C-extensions (cffi, gevent, etc.)
|
|
gcc \
|
|
g++ \
|
|
libffi-dev \
|
|
python3-dev \
|
|
# For locale
|
|
locales tzdata \
|
|
# For healthcheck
|
|
curl \
|
|
# For entrypoint
|
|
dumb-init \
|
|
# For debug
|
|
zip iputils-ping \
|
|
# For user switching
|
|
gosu \
|
|
# --- Tor support (activated via USING_TOR=true) ---
|
|
tor \
|
|
supervisor \
|
|
iptables \
|
|
# --- WireGuard support (activated via USING_WIREGUARD=true) ---
|
|
wireguard-tools \
|
|
iproute2 \
|
|
procps \
|
|
ca-certificates && \
|
|
# Configure iptables alternatives for tor.sh compatibility
|
|
update-alternatives --set iptables /usr/sbin/iptables-legacy && \
|
|
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy && \
|
|
# Cleanup APT cache *after* all installs in this layer
|
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
# Default to UTC timezone but will be overridden by the entrypoint script
|
|
ln -snf /usr/share/zoneinfo/UTC /etc/localtime && echo UTC > /etc/timezone && \
|
|
# Configure locale
|
|
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
|
|
locale-gen en_US.UTF-8 && \
|
|
echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
|
|
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
|
|
|
# Create a fixed runtime user/group so hardened Docker/Kubernetes deployments
|
|
# can start the container directly as a non-root user with a passwd entry.
|
|
RUN groupadd -g 1000 shelfmark && \
|
|
useradd -u 1000 -g shelfmark -d /home/shelfmark -s /usr/sbin/nologin shelfmark && \
|
|
mkdir -p /home/shelfmark && \
|
|
chown 1000:1000 /home/shelfmark
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Install core Python dependencies first for better layer caching
|
|
COPY pyproject.toml uv.lock ./
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
--mount=from=uv,source=/uv,target=/usr/local/bin/uv \
|
|
uv sync --locked --no-default-groups
|
|
|
|
# Runtime dependencies are installed into /app/.venv during the build. Remove the
|
|
# base image's system pip so stale installer CVEs do not ship in the final image.
|
|
RUN rm -rf \
|
|
/usr/local/bin/pip \
|
|
/usr/local/bin/pip3 \
|
|
/usr/local/bin/pip3.* \
|
|
/usr/local/lib/python*/site-packages/pip \
|
|
/usr/local/lib/python*/site-packages/pip-*.dist-info
|
|
|
|
# Copy application code *after* dependencies are installed
|
|
COPY . .
|
|
|
|
# Copy built frontend from frontend-builder stage
|
|
COPY --from=frontend-builder /frontend/dist /app/frontend-dist
|
|
|
|
# Final setup: create image-owned runtime paths for the fixed non-root user.
|
|
# Root/PUID mode still re-homes ownership at startup when needed.
|
|
RUN mkdir -p \
|
|
/config \
|
|
/books \
|
|
/var/log/shelfmark \
|
|
/tmp/shelfmark/seleniumbase/downloaded_files \
|
|
/tmp/shelfmark/seleniumbase/archived_files && \
|
|
rm -rf /app/downloaded_files /app/archived_files && \
|
|
ln -s /tmp/shelfmark/seleniumbase/downloaded_files /app/downloaded_files && \
|
|
ln -s /tmp/shelfmark/seleniumbase/archived_files /app/archived_files && \
|
|
chown -R 1000:1000 /config /books /home/shelfmark /tmp/shelfmark /var/log/shelfmark && \
|
|
chmod -R a+rX /app && \
|
|
chmod +x /app/entrypoint.sh /app/tor.sh /app/wireguard.sh /app/genDebug.sh
|
|
|
|
# Expose the application port
|
|
EXPOSE ${FLASK_PORT}
|
|
|
|
# Add healthcheck for container status
|
|
# Uses /api/health which doesn't require authentication.
|
|
# curl needs -f so an HTTP error status fails the probe instead of passing it:
|
|
# plain `curl -s` exits 0 on a 500, which reported a broken app as healthy.
|
|
# timeout stays well under interval so a hung probe cannot occupy a whole cycle.
|
|
# --start-interval matches the daemon default (5s), made explicit so startup
|
|
# probing does not depend on that default staying put.
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --start-interval=5s --retries=3 \
|
|
CMD curl -fsS http://localhost:${FLASK_PORT}/api/health > /dev/null || exit 1
|
|
|
|
# Use dumb-init as the entrypoint to handle signals properly
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|
|
|
|
|
FROM base AS shelfmark
|
|
|
|
# --- Chromium (PINNED to 149.0.7827.196) ---
|
|
# Debian's chromium 150.0.7871.46-1~deb13u1 security update (trixie-security,
|
|
# 2026-07-05) no longer opens the DevTools remote-debugging TCP port at all
|
|
# (no listener, no DevToolsActivePort file, even with a custom --user-data-dir;
|
|
# the RemoteDebuggingAllowed policy does not restore it). The SeleniumBase
|
|
# Pure-CDP driver connects through that port (/json/version), so with 150 every
|
|
# internal bypass dies with "Pure CDP browser startup failed" and all
|
|
# CF-gated downloads fail. Install the last working version from
|
|
# snapshot.debian.org until the bypasser can talk to Chromium >= 150 (e.g.
|
|
# pipe-based DevTools / UC mode) or seleniumbase ships a fix.
|
|
# Chrome 144+ requires --enable-unsafe-swiftshader for WebGL in Docker.
|
|
# This flag is set in internal_bypasser.py _get_browser_args()
|
|
ARG CHROMIUM_VERSION=149.0.7827.196-1~deb13u1
|
|
ARG CHROMIUM_SNAPSHOT=20260704T000000Z
|
|
|
|
RUN echo "deb [check-valid-until=no] https://snapshot.debian.org/archive/debian-security/${CHROMIUM_SNAPSHOT}/ trixie-security main" \
|
|
> /etc/apt/sources.list.d/chromium-pin-snapshot.list && \
|
|
apt-get update -o Acquire::Retries=5 && \
|
|
apt-get install -y --no-install-recommends -o Acquire::Retries=5 \
|
|
# For dumb display
|
|
xvfb \
|
|
# For screen recording
|
|
ffmpeg \
|
|
chromium=${CHROMIUM_VERSION} \
|
|
chromium-common=${CHROMIUM_VERSION} \
|
|
# For tkinter (pyautogui)
|
|
python3-tk \
|
|
# For RAR extraction
|
|
unrar-free && \
|
|
# Keep apt from "upgrading" chromium past the pin inside derived images
|
|
printf 'Package: chromium chromium-common\nPin: version %s\nPin-Priority: 1001\n' "${CHROMIUM_VERSION}" \
|
|
> /etc/apt/preferences.d/chromium-pin && \
|
|
rm /etc/apt/sources.list.d/chromium-pin-snapshot.list && \
|
|
# Create symlink so rarfile library can find unrar
|
|
ln -sf /usr/bin/unrar-free /usr/bin/unrar && \
|
|
# Cleanup APT cache
|
|
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install the browser automation stack used by the full image
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
--mount=from=uv,source=/uv,target=/usr/local/bin/uv \
|
|
uv sync --locked --no-default-groups --extra browser
|
|
|
|
# Deterministically resolve the Xlib namespace collision.
|
|
# pyautogui/mouseinfo pull the stale `python3-xlib` (0.15, 2014), while the
|
|
# `--extra browser` set pulls `python-xlib` (0.33). Both packages install into
|
|
# the same top-level `Xlib/` namespace, so whichever lands last wins. When the
|
|
# 2014 build wins, `Xlib.X` is missing `FamilyServerInterpreted`, which the
|
|
# SeleniumBase Pure-CDP driver requires at browser startup -> every bypass fails
|
|
# with "module 'Xlib.X' has no attribute 'FamilyServerInterpreted'" and no
|
|
# Cloudflare/DDoS-Guard protected download can complete. Drop the stale package
|
|
# and force python-xlib 0.33 to own the namespace. pyautogui runs fine against
|
|
# 0.33 (superset API).
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
--mount=from=uv,source=/uv,target=/usr/local/bin/uv \
|
|
uv pip uninstall --python /app/.venv/bin/python python3-xlib && \
|
|
uv pip install --python /app/.venv/bin/python --reinstall python-xlib==0.33 && \
|
|
/app/.venv/bin/python -c "import Xlib.X; assert hasattr(Xlib.X, 'FamilyServerInterpreted'), 'Xlib.X.FamilyServerInterpreted missing after fix'; print('Xlib namespace OK:', Xlib.__version__)"
|
|
|
|
# Keep SeleniumBase's bundled driver cache writable for the fixed non-root user.
|
|
RUN SELENIUMBASE_DRIVERS_DIR=$(/app/.venv/bin/python -c "import pathlib, seleniumbase; print(pathlib.Path(seleniumbase.__file__).resolve().parent / 'drivers')") && \
|
|
chown -R 1000:1000 "${SELENIUMBASE_DRIVERS_DIR}" && \
|
|
chmod -R u+rwX,go+rX "${SELENIUMBASE_DRIVERS_DIR}" && \
|
|
if [ -f "${SELENIUMBASE_DRIVERS_DIR}/uc_driver" ]; then chmod +x "${SELENIUMBASE_DRIVERS_DIR}/uc_driver"; fi
|
|
|
|
# Grant read/execute permissions to others
|
|
RUN chmod -R o+rx /usr/bin/chromium
|
|
|
|
# Default command to run the application entrypoint script
|
|
CMD ["/app/entrypoint.sh"]
|
|
|
|
FROM base AS shelfmark-lite
|
|
|
|
ENV USING_EXTERNAL_BYPASSER=true
|
|
|
|
CMD ["/app/entrypoint.sh"]
|