Reduce Docker runtime image size with separate npm build stage

This commit is contained in:
Dymas committed 2026-10-17 13:28:01 +02:00
1 parent aeef7d8366
commit fe437a9e6f
5 files changed
+16 -6

No files matched your search

+5
View File
@@ -1,5 +1,10 @@
# Changelog
## 0.54.14 - 2026-10-17
- Reduced the Docker image by installing npm dependencies in a separate build stage and keeping npm and its Debian toolchain out of the runtime image. The image still includes Node.js, ffmpeg, openssl, curl impersonation, and all application modules.
- Checked bundled anime providers against upstream; newer upstream versions are available and are not changed by this image update.
## 0.54.13 - 2026-10-14
- Fixed the Docker image startup failure by copying `watchlist_backup.py` into `/app`. Added packaging regression coverage; existing instance state and backup volumes are unchanged.
+6 -3
View File
@@ -1,5 +1,10 @@
FROM lexiforest/curl-impersonate:v2.2.2 AS curl_impersonate
FROM node:20-bookworm-slim AS node_dependencies
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev && npm cache clean --force
FROM python:3.12-slim-bookworm
ENV DEBIAN_FRONTEND=noninteractive \
@@ -19,7 +24,6 @@ RUN apt-get update \
curl \
ffmpeg \
nodejs \
npm \
openssl \
util-linux \
&& rm -rf /var/lib/apt/lists/*
@@ -29,8 +33,7 @@ COPY --from=curl_impersonate /usr/local/lib/ /usr/local/lib/
RUN mkdir -p /app
COPY package.json package-lock.json /app/
RUN cd /app && npm ci --omit=dev
COPY --from=node_dependencies /app/node_modules /app/node_modules
COPY ai_subtitles.py ai_subtitles_page.py app.py app_support.py config_page.py http_handler.py provider_bridge.py provider_downloader.py provider_updates.py queue_jobs.py queue_page.py search_page.py template_helpers.py title_matching.py watchlist_backup.py watchlist_identity.py watchlist_page.py web_templates.py VERSION CHANGELOG.md favicon.png /app/
COPY providers /app/providers
+1 -1
View File
@@ -15,7 +15,7 @@ With Docker installed, run from this checkout:
docker compose up -d --build
```
Prebuilt image: `gitea.coreplay.eu/dymas/kaizoku:latest` (also tagged by release version).
Prebuilt image: `gitea.coreplay.eu/dymas/kaizoku:latest` (also tagged by release version). The Docker image uses a separate build stage for npm dependencies to keep the runtime image smaller.
Open **http://127.0.0.1:8421/**. For access from another device, set `KAIZOKU_ALLOW_REMOTE=1`, `KAIZOKU_AUTH_USERNAME`, and `KAIZOKU_AUTH_PASSWORD` before starting Compose.
+1 -1
View File
@@ -1 +1 @@
0.54.13
0.54.14
+3 -1
View File
@@ -5257,7 +5257,9 @@ class TemplateHelperTests(unittest.TestCase):
self.assertEqual(package["dependencies"]["cheerio"], "1.0.0")
self.assertEqual(lock["packages"]["node_modules/cheerio"]["version"], "1.0.0")
self.assertIn("COPY package.json package-lock.json /app/", dockerfile)
self.assertIn("FROM node:20-bookworm-slim AS node_dependencies", dockerfile)
self.assertIn("COPY package.json package-lock.json ./", dockerfile)
self.assertIn("COPY --from=node_dependencies /app/node_modules /app/node_modules", dockerfile)
self.assertIn("npm ci --omit=dev", dockerfile)
self.assertIn("FROM lexiforest/curl-impersonate:v2.2.2 AS curl_impersonate", dockerfile)
self.assertIn("COPY --from=curl_impersonate /usr/local/bin/ /usr/local/bin/", dockerfile)