Files
shelfmark/Dockerfile
T
dependabot[bot] 256ba7e6e6 build(deps): bump astral-sh/uv from 0.13.7 to 0.13.8 in the docker-base-image-digests group (#1708)
> [!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.13.7 to 0.13.8
<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.13.8</h2>
<h2>Release Notes</h2>
<p>Released on 2026-11-12.</p>
<h3>Python</h3>
<ul>
<li>Add CPython 3.16.0a2 (<a
href="https://redirect.github.com/astral-sh/uv/pull/23211">#23211</a>)</li>
<li>Update managed CPython 3.11, 3.12, 3.13, 3.14, and 3.15 builds to
include pip 26.3, zlib 1.4, and Expat 2.10.0 (<a
href="https://redirect.github.com/astral-sh/uv/pull/23211">#23211</a>)</li>
<li>Update GraalPy 3.13.0 to build 25.5.5 (<a
href="https://redirect.github.com/astral-sh/uv/pull/23088">#23088</a>)</li>
</ul>
<h3>Preview features</h3>
<ul>
<li>Install wheel variants from local paths, direct URLs, and Git
repositories in platform-specific resolutions (<a
href="https://redirect.github.com/astral-sh/uv/pull/22720">#22720</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/22722">#22722</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/22724">#22724</a>)</li>
<li>Detect x86-64 microarchitecture levels and AArch64 architecture
versions when selecting wheel variants (<a
href="https://redirect.github.com/astral-sh/uv/pull/22832">#22832</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/22949">#22949</a>)</li>
<li>Detect Google TPUs up when selecting wheel variants (<a
href="https://redirect.github.com/astral-sh/uv/pull/23066">#23066</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/23121">#23121</a>)</li>
<li>Fix CPU detection for wheel variants on macOS with GraalPy (<a
href="https://redirect.github.com/astral-sh/uv/pull/23089">#23089</a>)</li>
<li>Report quarantined packages in <code>uv audit</code> when index URLs
differ only in redacted query values (<a
href="https://redirect.github.com/astral-sh/uv/pull/23129">#23129</a>)</li>
</ul>
<h3>Performance</h3>
<ul>
<li>Avoid duplicate environment builds when concurrent <code>uvx</code>
or <code>uv run --with</code> invocations need the same environment (<a
href="https://redirect.github.com/astral-sh/uv/pull/23123">#23123</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Restrict Unix plaintext credential files to owner-only permissions
(<a
href="https://redirect.github.com/astral-sh/uv/pull/23209">#23209</a>)</li>
<li>Honor per-index <code>exclude-newer-package</code> cutoffs during
resolution (<a
href="https://redirect.github.com/astral-sh/uv/pull/23122">#23122</a>)</li>
<li>Respect negative extra markers on constraints (<a
href="https://redirect.github.com/astral-sh/uv/pull/23144">#23144</a>)</li>
<li>Resolve dependencies of recursive extras from a scoped override (<a
href="https://redirect.github.com/astral-sh/uv/pull/23210">#23210</a>)</li>
<li>Fix <code>activate.bat</code> for Windows virtual environments whose
paths contain apostrophes (<a
href="https://redirect.github.com/astral-sh/uv/pull/23152">#23152</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Document the shell requirement for GitLab CI job images (<a
href="https://redirect.github.com/astral-sh/uv/pull/23078">#23078</a>)</li>
</ul>
<h2>Install uv 0.13.8</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.13.8/uv-installer.sh
| sh
</code></pre>
<h3>Install prebuilt binaries via powershell script</h3>
<pre lang="sh"><code>powershell -ExecutionPolicy Bypass -c &quot;irm
https://releases.astral.sh/github/uv/releases/download/0.13.8/uv-installer.ps1
| iex&quot;
</code></pre>
<h2>Download uv 0.13.8</h2>
<!-- 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.13.8</h2>
<p>Released on 2026-11-12.</p>
<h3>Python</h3>
<ul>
<li>Add CPython 3.16.0a2 (<a
href="https://redirect.github.com/astral-sh/uv/pull/23211">#23211</a>)</li>
<li>Update managed CPython 3.11, 3.12, 3.13, 3.14, and 3.15 builds to
include pip 26.3, zlib 1.4, and Expat 2.10.0 (<a
href="https://redirect.github.com/astral-sh/uv/pull/23211">#23211</a>)</li>
<li>Update GraalPy 3.13.0 to build 25.5.5 (<a
href="https://redirect.github.com/astral-sh/uv/pull/23088">#23088</a>)</li>
</ul>
<h3>Preview features</h3>
<ul>
<li>Install wheel variants from local paths, direct URLs, and Git
repositories in platform-specific resolutions (<a
href="https://redirect.github.com/astral-sh/uv/pull/22720">#22720</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/22722">#22722</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/22724">#22724</a>)</li>
<li>Detect x86-64 microarchitecture levels and AArch64 architecture
versions when selecting wheel variants (<a
href="https://redirect.github.com/astral-sh/uv/pull/22832">#22832</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/22949">#22949</a>)</li>
<li>Detect Google TPUs up when selecting wheel variants (<a
href="https://redirect.github.com/astral-sh/uv/pull/23066">#23066</a>,
<a
href="https://redirect.github.com/astral-sh/uv/pull/23121">#23121</a>)</li>
<li>Fix CPU detection for wheel variants on macOS with GraalPy (<a
href="https://redirect.github.com/astral-sh/uv/pull/23089">#23089</a>)</li>
<li>Report quarantined packages in <code>uv audit</code> when index URLs
differ only in redacted query values (<a
href="https://redirect.github.com/astral-sh/uv/pull/23129">#23129</a>)</li>
</ul>
<h3>Performance</h3>
<ul>
<li>Avoid duplicate environment builds when concurrent <code>uvx</code>
or <code>uv run --with</code> invocations need the same environment (<a
href="https://redirect.github.com/astral-sh/uv/pull/23123">#23123</a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>Restrict Unix plaintext credential files to owner-only permissions
(<a
href="https://redirect.github.com/astral-sh/uv/pull/23209">#23209</a>)</li>
<li>Honor per-index <code>exclude-newer-package</code> cutoffs during
resolution (<a
href="https://redirect.github.com/astral-sh/uv/pull/23122">#23122</a>)</li>
<li>Respect negative extra markers on constraints (<a
href="https://redirect.github.com/astral-sh/uv/pull/23144">#23144</a>)</li>
<li>Resolve dependencies of recursive extras from a scoped override (<a
href="https://redirect.github.com/astral-sh/uv/pull/23210">#23210</a>)</li>
<li>Fix <code>activate.bat</code> for Windows virtual environments whose
paths contain apostrophes (<a
href="https://redirect.github.com/astral-sh/uv/pull/23152">#23152</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Document the shell requirement for GitLab CI job images (<a
href="https://redirect.github.com/astral-sh/uv/pull/23078">#23078</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/astral-sh/uv/commit/3d97a6aad5ad989c1b4fc89406d54f0dce370b72"><code>3d97a6a</code></a>
Bump version to 0.13.8 (<a
href="https://redirect.github.com/astral-sh/uv/issues/23225">#23225</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/6ff87607937b55055ed4c75d3e965aad61bcbc91"><code>6ff8760</code></a>
Use the runner’s gcloud in registry tests (<a
href="https://redirect.github.com/astral-sh/uv/issues/23198">#23198</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/d08ae21ec18b05e90df4a17830839327f0221eef"><code>d08ae21</code></a>
Avoid running the same generators twice in CI (<a
href="https://redirect.github.com/astral-sh/uv/issues/23200">#23200</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/27095522ca18b1ffb64289d168a42e7ff0e35ed9"><code>2709552</code></a>
Use the runner’s btrfs-progs in Linux tests (<a
href="https://redirect.github.com/astral-sh/uv/issues/23197">#23197</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/f45ea9bd5335a60832c10cfb359b8e58bc358810"><code>f45ea9b</code></a>
Sync latest Python releases, CPython 3.16.0a2 (<a
href="https://redirect.github.com/astral-sh/uv/issues/23211">#23211</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/cb44dfa2757fbf52952119c0e4b55d2a3c9be4ec"><code>cb44dfa</code></a>
fix: preserve apostrophes in Windows activation paths (<a
href="https://redirect.github.com/astral-sh/uv/issues/23152">#23152</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/1c4fe21a188f83e4c1b9f216e9f291adb6c68e16"><code>1c4fe21</code></a>
Restrict Unix plaintext credential store permissions (<a
href="https://redirect.github.com/astral-sh/uv/issues/23209">#23209</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/5122f6e6d9cabe9e4e7d4a0eb5406ee428dbc84d"><code>5122f6e</code></a>
Flatten recursive extras introduced by scoped overrides (<a
href="https://redirect.github.com/astral-sh/uv/issues/23210">#23210</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/e3fa05604f7a825cb7fca9de4c17d5cc1ac331e8"><code>e3fa056</code></a>
Link issue artifacts to the workflow's run name (<a
href="https://redirect.github.com/astral-sh/uv/issues/23208">#23208</a>)</li>
<li><a
href="https://github.com/astral-sh/uv/commit/a2dd82a8fe738532058d7ea877e4b7cf6d1561b7"><code>a2dd82a</code></a>
Update Rust crate tokio to v1.53.2 (<a
href="https://redirect.github.com/astral-sh/uv/issues/23169">#23169</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/astral-sh/uv/compare/0.13.7...0.13.8">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.13.7&new-version=0.13.8)](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>

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Chores**
* Updated the container build process to use a newer version of its
build tool, with its integrity check updated accordingly. This change
affects how the application image is built and does not change
user-facing features or behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-11-13 00:57:16 -05:00

289 lines
12 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.13.8@sha256:5cc1805e2426484abca4ad46ea783bab281fdb225fd82d8ce6d66a81254bac85 AS uv
# Use python-slim as the base image
FROM python:3.14.9-slim@sha256:35caba83af2fe6da9a5d922f9b0156f21d1246a48278c58a08bd253303ba42e8 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 (Debian's current build from trixie-security) ---
RUN apt-get update -o Acquire::Retries=5 && \
apt-get install -y --no-install-recommends -o Acquire::Retries=5 \
# For dumb display
xvfb \
chromium \
# For tkinter (pyautogui)
python3-tk \
# For RAR extraction
unrar-free && \
# 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 && \
# Selenium ships prebuilt selenium-manager binaries (about 22MB) for every
# platform. They only run when selenium has to locate a webdriver, and the
# bypasser drives the browser through SeleniumBase's Pure-CDP driver, which
# needs none. Removed in this layer so the image does not carry them.
find /app/.venv/lib -name 'selenium-manager*' -delete
# 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"]