Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e4b2d2

Browse files
author
Peter Bengtsson
authored
Next v12 (#24082)
* next v12 * stick to exact * avoid segfault
1 parent 91fd4ac commit 4e4b2d2

5 files changed

Lines changed: 350 additions & 686 deletions

File tree

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# --------------------------------------------------------------------------------
66
# BASE IMAGE
77
# --------------------------------------------------------------------------------
8-
FROM node:16.2.0-alpine as base
8+
FROM node:16-alpine as base
99

1010
RUN apk add --no-cache make g++ git
1111

@@ -22,6 +22,10 @@ COPY package*.json ./
2222

2323
RUN npm ci
2424

25+
# This the appropriate necessary extra for node:16-alpine
26+
# Other options are https://www.npmjs.com/search?q=%40next%2Fswc
27+
RUN npm i @next/swc-linux-x64-musl --no-save
28+
2529

2630
# ---------------
2731
# PROD DEPS
@@ -54,7 +58,7 @@ RUN npm run build
5458
# MAIN IMAGE
5559
# --------------------------------------------------------------------------------
5660

57-
FROM node:16.2.0-alpine as production
61+
FROM node:16-alpine as production
5862

5963
# Let's make our home
6064
WORKDIR /usr/src/docs

middleware/next.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import next from 'next'
22

3+
// This import is necessary, as of Jan 2022 to avoid a segmentation fault.
4+
// Next is suppose to automatically pick up the `next.config.js` file
5+
// but if you don't specify it to the `next()` constructor you currently
6+
// get a seg fault.
7+
// Possibly relevant: https://github.com/vercel/next.js/issues/33008
8+
import conf from '../next.config.js'
9+
310
const { NODE_ENV } = process.env
411
const isDevelopment = NODE_ENV === 'development'
512

6-
export const nextApp = next({ dev: isDevelopment })
13+
export const nextApp = next({ dev: isDevelopment, conf })
714
export const nextHandleRequest = nextApp.getRequestHandler()
815
await nextApp.prepare()
916

next-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference types="next" />
2-
/// <reference types="next/types/global" />
32
/// <reference types="next/image-types/global" />
43

54
// NOTE: This file should not be edited

0 commit comments

Comments
 (0)