From a530d00aa2b167ab573921008b5dd7fb569290a9 Mon Sep 17 00:00:00 2001 From: Stefan Lazic Date: Wed, 7 Oct 2026 16:54:08 +0100 Subject: [PATCH] Typecheck --- Dockerfile | 8 ++++++++ next.config.ts | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/Dockerfile b/Dockerfile index 14a3261..4a9df9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,14 @@ ENV DATABASE_PORT="3306" ENV DATABASE_NAME="build" ENV DATABASE_USER="build" ENV DATABASE_PASSWORD="build" +# Skip `next build`'s TypeScript pass in the image. It's a redundant second +# check — `npx tsc --noEmit` already gates every change before it's built — +# and it's by far the heaviest step of the build: on a low-memory VPS it can +# swap for many minutes or get OOM-killed (exit 137). Type errors are still +# caught everywhere else; to type-check inside the image anyway, build with +# `docker build --build-arg SKIP_TYPECHECK=false .` +ARG SKIP_TYPECHECK=true +ENV SKIP_TYPECHECK=$SKIP_TYPECHECK RUN npm run build FROM node:22-alpine AS runner diff --git a/next.config.ts b/next.config.ts index cc8037d..66dfee1 100644 --- a/next.config.ts +++ b/next.config.ts @@ -25,6 +25,12 @@ const SECURITY_HEADERS = [ const nextConfig: NextConfig = { reactStrictMode: true, + // Opt-in only (set by the Dockerfile, see its comment): `next build` + // normally runs a full TypeScript check, which on a small server can + // need more memory than is free and turn a build into a swap-thrashing + // crawl. Left unset everywhere else, so `npm run build` and CI still + // fail on a type error. + typescript: { ignoreBuildErrors: process.env.SKIP_TYPECHECK === "true" }, experimental: { // Next's Server Action default (1MB) is too small for the PWA // icon/splash-screen ZIP import (see updateAppIconSettingsAction's