Fix harness crash: load standalone config to skip webpack in production
The standalone next package is trimmed and doesn't include webpack. The custom server.js was using next() which triggers config loading that requires webpack. Fix by extracting the standalone config at build time and setting __NEXT_PRIVATE_STANDALONE_CONFIG before requiring next, matching what the generated standalone server does.
This commit is contained in:
@@ -25,6 +25,11 @@ COPY --from=deps /app ./
|
||||
COPY packages/db ./packages/db
|
||||
COPY apps/harness ./apps/harness
|
||||
RUN pnpm --filter @homelab/harness build
|
||||
# Extract standalone next config so the custom server can skip webpack loading
|
||||
RUN node -e "\
|
||||
const s = require('fs').readFileSync('apps/harness/.next/standalone/apps/harness/server.js','utf8');\
|
||||
const m = s.match(/const nextConfig = (\\{.+\\})\n/);\
|
||||
require('fs').writeFileSync('apps/harness/.next/standalone/apps/harness/next-config.json', m[1]);"
|
||||
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
Reference in New Issue
Block a user