mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-11-10 12:28:27 +00:00
> [!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.6 to 0.13.7 <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.7</h2> <h2>Release Notes</h2> <p>Released on 2026-11-03.</p> <h3>Preview features</h3> <ul> <li>Add <code>--output-version</code> to <code>uv workspace metadata</code> for requesting a specific schema version (<a href="https://redirect.github.com/astral-sh/uv/pull/22958">#22958</a>)</li> <li>Report aliased OSV records as a single vulnerability in <code>uv audit</code> (<a href="https://redirect.github.com/astral-sh/uv/pull/22990">#22990</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Treat workspace member paths added by <code>uv init</code> or <code>uv add</code> as literals instead of glob patterns (<a href="https://redirect.github.com/astral-sh/uv/pull/23008">#23008</a>)</li> <li>Prevent uv's Windows trampolines from closing handles they did not inherit (<a href="https://redirect.github.com/astral-sh/uv/pull/22977">#22977</a>)</li> <li>Allow <code>uvx</code> to run tools with CPython builds whose versions contain local identifiers (<a href="https://redirect.github.com/astral-sh/uv/pull/23013">#23013</a>)</li> <li>Generate valid module names when <code>uv init</code> creates packaged projects whose names start with a digit (<a href="https://redirect.github.com/astral-sh/uv/pull/23022">#23022</a>)</li> <li>Preserve comments around existing inline dependency groups when <code>uv add</code> updates a group (<a href="https://redirect.github.com/astral-sh/uv/pull/23017">#23017</a>)</li> <li>Allow <code>uv remove</code> with an empty inline <code>tool.uv.sources</code> table (<a href="https://redirect.github.com/astral-sh/uv/pull/23012">#23012</a>)</li> </ul> <h3>Documentation</h3> <ul> <li>Correct the <code>cache-keys</code> inline table example (<a href="https://redirect.github.com/astral-sh/uv/pull/22984">#22984</a>)</li> </ul> <h2>Install uv 0.13.7</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.7/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.13.7/uv-installer.ps1 | iex" </code></pre> <h2>Download uv 0.13.7</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.13.7/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.13.7/uv-aarch64-apple-darwin.tar.gz.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.13.7/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.13.7/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.13.7/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.13.7/uv-aarch64-pc-windows-msvc.zip.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.13.7/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.13.7/uv-i686-pc-windows-msvc.zip.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.13.7/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.13.7/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.13.7/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.13.7/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.13.7/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.13.7/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.13.7/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.13.7/uv-powerpc64le-unknown-linux-gnu.tar.gz.sha256">checksum</a></td> </tr> <tr> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.13.7/uv-riscv64gc-unknown-linux-gnu.tar.gz">uv-riscv64gc-unknown-linux-gnu.tar.gz</a></td> <td>RISCV Linux</td> <td><a href="https://releases.astral.sh/github/uv/releases/download/0.13.7/uv-riscv64gc-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.13.7</h2> <p>Released on 2026-11-03.</p> <h3>Preview features</h3> <ul> <li>Add <code>--output-version</code> to <code>uv workspace metadata</code> for requesting a specific schema version (<a href="https://redirect.github.com/astral-sh/uv/pull/22958">#22958</a>)</li> <li>Report aliased OSV records as a single vulnerability in <code>uv audit</code> (<a href="https://redirect.github.com/astral-sh/uv/pull/22990">#22990</a>)</li> </ul> <h3>Bug fixes</h3> <ul> <li>Treat workspace member paths added by <code>uv init</code> or <code>uv add</code> as literals instead of glob patterns (<a href="https://redirect.github.com/astral-sh/uv/pull/23008">#23008</a>)</li> <li>Prevent uv's Windows trampolines from closing handles they did not inherit (<a href="https://redirect.github.com/astral-sh/uv/pull/22977">#22977</a>)</li> <li>Allow <code>uvx</code> to run tools with CPython builds whose versions contain local identifiers (<a href="https://redirect.github.com/astral-sh/uv/pull/23013">#23013</a>)</li> <li>Generate valid module names when <code>uv init</code> creates packaged projects whose names start with a digit (<a href="https://redirect.github.com/astral-sh/uv/pull/23022">#23022</a>)</li> <li>Preserve comments around existing inline dependency groups when <code>uv add</code> updates a group (<a href="https://redirect.github.com/astral-sh/uv/pull/23017">#23017</a>)</li> <li>Allow <code>uv remove</code> with an empty inline <code>tool.uv.sources</code> table (<a href="https://redirect.github.com/astral-sh/uv/pull/23012">#23012</a>)</li> </ul> <h3>Documentation</h3> <ul> <li>Correct the <code>cache-keys</code> inline table example (<a href="https://redirect.github.com/astral-sh/uv/pull/22984">#22984</a>)</li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/astral-sh/uv/commit/316c827e058c16b71d5c507a20729c2995a7bcce"><code>316c827</code></a> Bump version to 0.13.7 (<a href="https://redirect.github.com/astral-sh/uv/issues/23068">#23068</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/917b4c31531e6933c20596b65b49e75c83ff7d93"><code>917b4c3</code></a> Update Rust crate tokio-rustls to v0.26.6 (<a href="https://redirect.github.com/astral-sh/uv/issues/23048">#23048</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/baec6ce829bea457e5452906144115940e1ea896"><code>baec6ce</code></a> Update conda-incubator/setup-miniconda action to v4.1.0 (<a href="https://redirect.github.com/astral-sh/uv/issues/23032">#23032</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/da8bbd3365161177fc30909aa0b84d45e8811f09"><code>da8bbd3</code></a> Update fedora Docker tag to v46 (<a href="https://redirect.github.com/astral-sh/uv/issues/23033">#23033</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/3db723cf104c685b9f2f31a26834b7d417db652f"><code>3db723c</code></a> Update Rust crate cargo-util to v0.2.32 (<a href="https://redirect.github.com/astral-sh/uv/issues/23045">#23045</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/28c0c65cd01ba9430787eef2f933740095609e09"><code>28c0c65</code></a> Update Rust crate uuid to v1.27.0 (<a href="https://redirect.github.com/astral-sh/uv/issues/23052">#23052</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/77168783ec37c93a786fce4bbaabe58d1255c22f"><code>7716878</code></a> Update Rust crate insta to v1.49.0 (<a href="https://redirect.github.com/astral-sh/uv/issues/23051">#23051</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/3be10e3890b942cb7509e656245b46e7ad63d650"><code>3be10e3</code></a> Update dependency <code>@openai/codex</code> to v0.160.0 (<a href="https://redirect.github.com/astral-sh/uv/issues/23050">#23050</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/8eb756a2e7a4a8380d49a3edd6224da4c5af4cea"><code>8eb756a</code></a> Update CodSpeedHQ/action action to v5.4.0 (<a href="https://redirect.github.com/astral-sh/uv/issues/23049">#23049</a>)</li> <li><a href="https://github.com/astral-sh/uv/commit/632df30b8e8c8ed1dbba309cc79c2608a63da155"><code>632df30</code></a> Update Rust crate spdx to v0.13.6 (<a href="https://redirect.github.com/astral-sh/uv/issues/23047">#23047</a>)</li> <li>Additional commits viewable in <a href="https://github.com/astral-sh/uv/compare/0.13.6...0.13.7">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> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Chores** * Updated the build environment’s `uv` version. <!-- 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>
289 lines
12 KiB
Docker
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.7@sha256:96f40d3904aad8d0bd010539001d36c8e2188b981e1334471a90c4a1d93bb490 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"]
|