Files
shelfmark/Dockerfile
T
dependabot[bot] 4b7607e224 build(deps): bump astral-sh/uv from 0.12.22 to 0.12.24 in the docker-base-image-digests group (#1449)
> [!WARNING]
> Cooldown could not be applied because no publication date was
available from the registry.
>

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.12.22 to 0.12.24
<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.24</h2>
<h2>Release Notes</h2>
<p>Released on 2026-10-08.</p>
<h3>Enhancements</h3>
<ul>
<li>Remove orphaned temporary build environments with <code>uv cache
prune</code> (<a
href="https://redirect.github.com/astral-sh/uv/pull/22171">#22171</a>)</li>
<li>Accept PEP 508 marker operators directly before grouped expressions
(<a
href="https://redirect.github.com/astral-sh/uv/pull/22309">#22309</a>)</li>
<li>Reject malformed requirements-file options instead of partially
parsing or ignoring them (<a
href="https://redirect.github.com/astral-sh/uv/pull/22317">#22317</a>)</li>
<li>Show underlying filesystem and registry errors when managed Python
uninstallation fails (<a
href="https://redirect.github.com/astral-sh/uv/pull/22362">#22362</a>)</li>
<li>Identify the invalid source URL in Python mirror errors (<a
href="https://redirect.github.com/astral-sh/uv/pull/22364">#22364</a>)</li>
</ul>
<h3>Preview features</h3>
<ul>
<li>Display preferred advisory IDs in <code>uv audit</code> reports,
prioritizing PYSEC, GHSA, then CVE identifiers (<a
href="https://redirect.github.com/astral-sh/uv/pull/22292">#22292</a>)</li>
</ul>
<h3>Configuration</h3>
<ul>
<li>Support custom installation mirrors for GraalPy (<a
href="https://redirect.github.com/astral-sh/uv/pull/22269">#22269</a>)</li>
<li>Support custom installation mirrors for Pyodide (<a
href="https://redirect.github.com/astral-sh/uv/pull/22271">#22271</a>)</li>
<li>Allow <code>UV_NO_CACHE=false</code> to override <code>no-cache =
true</code> in configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22324">#22324</a>)</li>
<li>Report more precise error locations for invalid trusted-host ports
and preview-feature list entries (<a
href="https://redirect.github.com/astral-sh/uv/pull/22144">#22144</a>)</li>
</ul>
<h3>Performance</h3>
<ul>
<li>Speed up later commands after creating an environment by warming its
interpreter cache (<a
href="https://redirect.github.com/astral-sh/uv/pull/21304">#21304</a>)</li>
<li>Reduce code-signature verification work for ARM64 macOS releases
with 16 KiB signature pages (<a
href="https://redirect.github.com/astral-sh/uv/pull/22246">#22246</a>)</li>
<li>Enforce resource limits when parsing package indexes and
<code>--find-links</code> pages with <code>astral-html</code> (<a
href="https://redirect.github.com/astral-sh/uv/pull/22203">#22203</a>)</li>
<li>Reduce standalone <code>uv-build</code> executable size by 7.5% by
omitting unused Zstandard support (<a
href="https://redirect.github.com/astral-sh/uv/pull/22242">#22242</a>)</li>
<li>Reduce uv's binary size by about 232 KB by simplifying configuration
deserialization (<a
href="https://redirect.github.com/astral-sh/uv/pull/22144">#22144</a>)</li>
<li>Reduce Python download error formatting code size by sharing its
formatter (<a
href="https://redirect.github.com/astral-sh/uv/pull/22141">#22141</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Verify supplied hashes even when hash presence is disabled with
<code>--no-require-hashes</code> or <code>require-hashes = false</code>
(<a
href="https://redirect.github.com/astral-sh/uv/pull/22369">#22369</a>)</li>
<li>Honor exact managed Python patch pins when creating script
environments instead of following patch upgrades (<a
href="https://redirect.github.com/astral-sh/uv/pull/22360">#22360</a>)</li>
<li>Prevent dependency overrides and constraints from activating
optional dependencies when their extras are not selected (<a
href="https://redirect.github.com/astral-sh/uv/pull/22237">#22237</a>)</li>
<li>Exclude optional dependencies from exports when their extras are
activated only in incompatible environments (<a
href="https://redirect.github.com/astral-sh/uv/pull/22234">#22234</a>)</li>
<li>Give explicit <code>uv publish --trusted-publishing</code> values
precedence over configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22279">#22279</a>)</li>
<li>Allow <code>UV_OFFLINE=false</code> to override <code>offline =
true</code> in configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22283">#22283</a>)</li>
<li>Allow <code>UV_SYSTEM_CERTS=false</code> to override
<code>system-certs = true</code> in configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22291">#22291</a>)</li>
<li>Allow <code>uv auth login</code> over IPv6 loopback addresses (<a
href="https://redirect.github.com/astral-sh/uv/pull/22306">#22306</a>)</li>
<li>Resolve GitHub dependencies whose Git references contain
<code>#</code> or <code>%</code> characters (<a
href="https://redirect.github.com/astral-sh/uv/pull/22281">#22281</a>)</li>
<li>Recognize existing Pyodide interpreters as satisfying Pyodide Python
requests (<a
href="https://redirect.github.com/astral-sh/uv/pull/22322">#22322</a>)</li>
<li>Preserve JSON output from <code>uv version</code> and <code>uv self
version</code> with a single <code>--quiet</code> flag (<a
href="https://redirect.github.com/astral-sh/uv/pull/22280">#22280</a>)</li>
<li>Preserve trailing spaces and tabs in passwords returned by
subprocess keyrings (<a
href="https://redirect.github.com/astral-sh/uv/pull/22284">#22284</a>)</li>
<li>Restore wheel incompatibility hints when <code>WHEEL</code> metadata
contains multiple expanded <code>Tag:</code> rows (<a
href="https://redirect.github.com/astral-sh/uv/pull/22235">#22235</a>)</li>
<li>Preserve Windows wheel-script rename errors unless a cross-drive
copy fallback applies (<a
href="https://redirect.github.com/astral-sh/uv/pull/22302">#22302</a>)</li>
<li>Prevent workspace-cache assertion failures after modifying a project
at the workspace root (<a
href="https://redirect.github.com/astral-sh/uv/pull/22236">#22236</a>)</li>
</ul>
<!-- 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.24</h2>
<p>Released on 2026-10-08.</p>
<h3>Enhancements</h3>
<ul>
<li>Remove orphaned temporary build environments with <code>uv cache
prune</code> (<a
href="https://redirect.github.com/astral-sh/uv/pull/22171">#22171</a>)</li>
<li>Accept PEP 508 marker operators directly before grouped expressions
(<a
href="https://redirect.github.com/astral-sh/uv/pull/22309">#22309</a>)</li>
<li>Reject malformed requirements-file options instead of partially
parsing or ignoring them (<a
href="https://redirect.github.com/astral-sh/uv/pull/22317">#22317</a>)</li>
<li>Show underlying filesystem and registry errors when managed Python
uninstallation fails (<a
href="https://redirect.github.com/astral-sh/uv/pull/22362">#22362</a>)</li>
<li>Identify the invalid source URL in Python mirror errors (<a
href="https://redirect.github.com/astral-sh/uv/pull/22364">#22364</a>)</li>
</ul>
<h3>Preview features</h3>
<ul>
<li>Display preferred advisory IDs in <code>uv audit</code> reports,
prioritizing PYSEC, GHSA, then CVE identifiers (<a
href="https://redirect.github.com/astral-sh/uv/pull/22292">#22292</a>)</li>
</ul>
<h3>Configuration</h3>
<ul>
<li>Support custom installation mirrors for GraalPy (<a
href="https://redirect.github.com/astral-sh/uv/pull/22269">#22269</a>)</li>
<li>Support custom installation mirrors for Pyodide (<a
href="https://redirect.github.com/astral-sh/uv/pull/22271">#22271</a>)</li>
<li>Allow <code>UV_NO_CACHE=false</code> to override <code>no-cache =
true</code> in configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22324">#22324</a>)</li>
<li>Report more precise error locations for invalid trusted-host ports
and preview-feature list entries (<a
href="https://redirect.github.com/astral-sh/uv/pull/22144">#22144</a>)</li>
</ul>
<h3>Performance</h3>
<ul>
<li>Speed up later commands after creating an environment by warming its
interpreter cache (<a
href="https://redirect.github.com/astral-sh/uv/pull/21304">#21304</a>)</li>
<li>Reduce code-signature verification work for ARM64 macOS releases
with 16 KiB signature pages (<a
href="https://redirect.github.com/astral-sh/uv/pull/22246">#22246</a>)</li>
<li>Enforce resource limits when parsing package indexes and
<code>--find-links</code> pages with <code>astral-html</code> (<a
href="https://redirect.github.com/astral-sh/uv/pull/22203">#22203</a>)</li>
<li>Reduce standalone <code>uv-build</code> executable size by 7.5% by
omitting unused Zstandard support (<a
href="https://redirect.github.com/astral-sh/uv/pull/22242">#22242</a>)</li>
<li>Reduce uv's binary size by about 232 KB by simplifying configuration
deserialization (<a
href="https://redirect.github.com/astral-sh/uv/pull/22144">#22144</a>)</li>
<li>Reduce Python download error formatting code size by sharing its
formatter (<a
href="https://redirect.github.com/astral-sh/uv/pull/22141">#22141</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Verify supplied hashes even when hash presence is disabled with
<code>--no-require-hashes</code> or <code>require-hashes = false</code>
(<a
href="https://redirect.github.com/astral-sh/uv/pull/22369">#22369</a>)</li>
<li>Honor exact managed Python patch pins when creating script
environments instead of following patch upgrades (<a
href="https://redirect.github.com/astral-sh/uv/pull/22360">#22360</a>)</li>
<li>Prevent dependency overrides and constraints from activating
optional dependencies when their extras are not selected (<a
href="https://redirect.github.com/astral-sh/uv/pull/22237">#22237</a>)</li>
<li>Exclude optional dependencies from exports when their extras are
activated only in incompatible environments (<a
href="https://redirect.github.com/astral-sh/uv/pull/22234">#22234</a>)</li>
<li>Give explicit <code>uv publish --trusted-publishing</code> values
precedence over configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22279">#22279</a>)</li>
<li>Allow <code>UV_OFFLINE=false</code> to override <code>offline =
true</code> in configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22283">#22283</a>)</li>
<li>Allow <code>UV_SYSTEM_CERTS=false</code> to override
<code>system-certs = true</code> in configuration (<a
href="https://redirect.github.com/astral-sh/uv/pull/22291">#22291</a>)</li>
<li>Allow <code>uv auth login</code> over IPv6 loopback addresses (<a
href="https://redirect.github.com/astral-sh/uv/pull/22306">#22306</a>)</li>
<li>Resolve GitHub dependencies whose Git references contain
<code>#</code> or <code>%</code> characters (<a
href="https://redirect.github.com/astral-sh/uv/pull/22281">#22281</a>)</li>
<li>Recognize existing Pyodide interpreters as satisfying Pyodide Python
requests (<a
href="https://redirect.github.com/astral-sh/uv/pull/22322">#22322</a>)</li>
<li>Preserve JSON output from <code>uv version</code> and <code>uv self
version</code> with a single <code>--quiet</code> flag (<a
href="https://redirect.github.com/astral-sh/uv/pull/22280">#22280</a>)</li>
<li>Preserve trailing spaces and tabs in passwords returned by
subprocess keyrings (<a
href="https://redirect.github.com/astral-sh/uv/pull/22284">#22284</a>)</li>
<li>Restore wheel incompatibility hints when <code>WHEEL</code> metadata
contains multiple expanded <code>Tag:</code> rows (<a
href="https://redirect.github.com/astral-sh/uv/pull/22235">#22235</a>)</li>
<li>Preserve Windows wheel-script rename errors unless a cross-drive
copy fallback applies (<a
href="https://redirect.github.com/astral-sh/uv/pull/22302">#22302</a>)</li>
<li>Prevent workspace-cache assertion failures after modifying a project
at the workspace root (<a
href="https://redirect.github.com/astral-sh/uv/pull/22236">#22236</a>)</li>
<li>Hide the ignored <code>--keyring-provider</code> option from
<code>uv auth</code> help (<a
href="https://redirect.github.com/astral-sh/uv/pull/19520">#19520</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/5411378eb76dc1ea1ad90aeb10e84e997e5bbd96"><code>5411378</code></a>
Bump version to 0.12.24 (<a
href="https://redirect.github.com/astral-sh/uv/issues/22371">#22371</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/213e6de8b643a831a84bbc12ff9f9ee6f0bfc13d"><code>213e6de</code></a>
Clarify integration test style in agent guidance (<a
href="https://redirect.github.com/astral-sh/uv/issues/22372">#22372</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/35deef2029377b87a293579f4c89548f2ec41f14"><code>35deef2</code></a>
Skip Python setup in static version and credential tests (<a
href="https://redirect.github.com/astral-sh/uv/issues/22370">#22370</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/bbddf2f44a7be6888b24264eb2d8a35293e7a58f"><code>bbddf2f</code></a>
Share requirements-file arguments across commands (<a
href="https://redirect.github.com/astral-sh/uv/issues/22145">#22145</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/9a123eb638016dee70515e326a4a5fa88e74e090"><code>9a123eb</code></a>
Deserialize trusted hosts and preview features directly (<a
href="https://redirect.github.com/astral-sh/uv/issues/22144">#22144</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/57a9256bf0ee3bb75e438f193c6a2afe2adc6e9c"><code>57a9256</code></a>
Share archive decoding across reader types (<a
href="https://redirect.github.com/astral-sh/uv/issues/22143">#22143</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/3e3374b961fefaed663747868c09e95863c9a3d2"><code>3e3374b</code></a>
Verify hashes even when they are not required (<a
href="https://redirect.github.com/astral-sh/uv/issues/22369">#22369</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/d3c092a30ed2712d15c855af652d5741d4d5c7c5"><code>d3c092a</code></a>
Move installation layout operations out of Python types (<a
href="https://redirect.github.com/astral-sh/uv/issues/22367">#22367</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/1be3e88341157061a75b68f78953ff3a3c309576"><code>1be3e88</code></a>
Accept PEP 508 marker operators before parentheses (<a
href="https://redirect.github.com/astral-sh/uv/issues/22309">#22309</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/e27def75aaf746634b7c6576bc23ebf572d101a5"><code>e27def7</code></a>
Retain Python download request errors directly (<a
href="https://redirect.github.com/astral-sh/uv/issues/22366">#22366</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/astral-sh/uv/compare/0.12.22...0.12.24">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=astral-sh/uv&package-manager=docker&previous-version=0.12.22&new-version=0.12.24)](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>
2026-10-20 01:24:26 -04:00

307 lines
13 KiB
Docker

ARG TARGETPLATFORM
ARG TARGETARCH
ARG BUILDPLATFORM
ARG BUILDARCH
# Frontend build stage.
FROM --platform=$BUILDPLATFORM node:24-alpine@sha256:ebfe2f90462722a7a4de65e91990e97fe0d401c70e0e762c5b53302f905ec1c1 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.24@sha256:3af4716e991d6956a41e573eab705d0ee08500cd829ed30293eb8472f372c65a AS uv
# Use python-slim as the base image
FROM python:3.14.7-slim@sha256:cad9a2c871761c413caa6fdd6441c783451e740a48aaeba60ae62a8b53525ef6 AS base
# 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 \
# No C toolchain: every compiled dependency (cffi, gevent, greenlet,
# zope-interface) ships a cp314 manylinux wheel for amd64 and arm64, and
# the sdist-only ones are pure Python. The toolchain was 290MB of the
# runtime image, and python3-dev pulled Debian's libpython3.13 into a 3.14
# image. If a dependency ever needs compiling, build it in a separate stage.
# 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
# The application code is deliberately NOT copied here. `base` is shared by the
# final stages, so a COPY of the source at this point invalidates every layer
# built on top of it -- the Chromium install, the browser dependency sync and
# the SeleniumBase driver download -- on any source change. Each stage copies
# the source as its last step instead, so a code-only rebuild rewrites one small
# layer and every expensive layer is reused. `[tool.uv] package = false` is what
# makes this safe: no `uv sync` needs the project source.
# 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__)"
# The venv's own pip goes too. uv seeded a copy into /app/.venv and nothing
# installs at runtime. setuptools deliberately STAYS: several deps still import
# pkg_resources on the hot path.
RUN rm -rf /app/.venv/bin/pip /app/.venv/bin/pip3 /app/.venv/bin/pip3.* \
/app/.venv/lib/python*/site-packages/pip \
/app/.venv/lib/python*/site-packages/pip-*.dist-info
# 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
# --- Application code: last, so every expensive layer above stays cached ---
COPY . .
COPY --from=frontend-builder /frontend/dist /app/frontend-dist
# The frontend SOURCE cannot be excluded via .dockerignore — that file applies
# to every stage and frontend-builder needs src/. Only the built dist (copied
# above) is served at runtime, so drop the source here.
RUN rm -rf /app/src
# 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
# Default command to run the application entrypoint script
# Version stamp last. These carry the commit sha, so they change on every
# build and everything below them rebuilds. Kept here, the dependency and
# browser layers above stay valid and a pull only fetches what changed.
ARG BUILD_VERSION
ENV BUILD_VERSION=${BUILD_VERSION}
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
CMD ["/app/entrypoint.sh"]
FROM base AS shelfmark-lite
ENV USING_EXTERNAL_BYPASSER=true
# --- Application code: last, so every expensive layer above stays cached ---
COPY . .
COPY --from=frontend-builder /frontend/dist /app/frontend-dist
# The frontend SOURCE cannot be excluded via .dockerignore — that file applies
# to every stage and frontend-builder needs src/. Only the built dist (copied
# above) is served at runtime, so drop the source here.
RUN rm -rf /app/src
# 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
# Version stamp last. These carry the commit sha, so they change on every
# build and everything below them rebuilds. Kept here, the dependency and
# browser layers above stay valid and a pull only fetches what changed.
ARG BUILD_VERSION
ENV BUILD_VERSION=${BUILD_VERSION}
ARG RELEASE_VERSION
ENV RELEASE_VERSION=${RELEASE_VERSION}
CMD ["/app/entrypoint.sh"]