Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(buildpack): stop browser-driver postinstalls from filling the build disk

Juan Denis0eeb1873658f
diff --git a/backend/app/services/buildpack_service.py b/backend/app/services/buildpack_service.py
index b4d106b3..ffae6e7b 100644
--- a/backend/app/services/buildpack_service.py
+++ b/backend/app/services/buildpack_service.py
@@ -531,6 +531,13 @@ class BuildpackService:
# Locally installed CLIs (vite, next, nest, ...) live in
# node_modules/.bin, which is not on PATH for RUN/CMD.
'ENV PATH=/app/node_modules/.bin:$PATH',
+ # Browser-driver postinstalls each fetch a few hundred MB of
+ # Chrome into the build layer (puppeteer alone is ~500MB). A
+ # production build never drives a browser, and on a small host
+ # that download is what fills the disk mid-export -- opt out.
+ 'ENV PUPPETEER_SKIP_DOWNLOAD=1 '
+ 'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 '
+ 'CYPRESS_INSTALL_BINARY=0',
'COPY package*.json ./',
]
if build:
diff --git a/backend/tests/test_buildpacks.py b/backend/tests/test_buildpacks.py
index ec0ed253..3cf1e630 100644
--- a/backend/tests/test_buildpacks.py
+++ b/backend/tests/test_buildpacks.py
@@ -175,6 +175,27 @@ def test_generate_dockerfile_node_build_keeps_dev_dependencies():
assert df.index('RUN npm install\n') < df.index('RUN npm run build')
+def test_generate_dockerfile_node_skips_browser_downloads():
+ """devDependencies stay, but their browser binaries must not.
+
+ Keeping devDependencies (see above) also drags in puppeteer/playwright/
+ cypress postinstalls, which fetch a full Chrome (~500MB) into the build
+ layer. Nothing in a production build drives a browser, and on a small
+ host that download is what exhausts the disk during image export.
+ """
+ plan = {
+ 'builder': 'nixpacks', 'language': 'node', 'framework': 'vite',
+ 'versions': {'node': '24'}, 'build_command': 'npm run build',
+ 'start_command': 'serve -s dist -l tcp://0.0.0.0:4173', 'port': 4173,
+ }
+ df = BuildpackService.generate_dockerfile(plan)
+ assert 'PUPPETEER_SKIP_DOWNLOAD=1' in df
+ assert 'PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1' in df
+ assert 'CYPRESS_INSTALL_BINARY=0' in df
+ # The opt-out only works if it is exported before the install runs.
+ assert df.index('PUPPETEER_SKIP_DOWNLOAD=1') < df.index('RUN npm install')
+
+
def test_detect_vite_defaults_to_serve_not_preview(tmp_path):
"""`vite preview` host-checks against preview.allowedHosts and blocks
every domain the panel proxy forwards -- the default start command must