Skip to content

Commit

Permalink
Next v12 (github#24082)
Browse files Browse the repository at this point in the history
* next v12

* stick to exact

* avoid segfault
  • Loading branch information
peterbe authored Jan 7, 2022
1 parent 91fd4ac commit 4e4b2d2
Show file tree
Hide file tree
Showing 5 changed files with 350 additions and 686 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# --------------------------------------------------------------------------------
# BASE IMAGE
# --------------------------------------------------------------------------------
FROM node:16.2.0-alpine as base
FROM node:16-alpine as base

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

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

RUN npm ci

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


# ---------------
# PROD DEPS
Expand Down Expand Up @@ -54,7 +58,7 @@ RUN npm run build
# MAIN IMAGE
# --------------------------------------------------------------------------------

FROM node:16.2.0-alpine as production
FROM node:16-alpine as production

# Let's make our home
WORKDIR /usr/src/docs
Expand Down
9 changes: 8 additions & 1 deletion middleware/next.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import next from 'next'

// This import is necessary, as of Jan 2022 to avoid a segmentation fault.
// Next is suppose to automatically pick up the `next.config.js` file
// but if you don't specify it to the `next()` constructor you currently
// get a seg fault.
// Possibly relevant: https://github.com/vercel/next.js/issues/33008
import conf from '../next.config.js'

const { NODE_ENV } = process.env
const isDevelopment = NODE_ENV === 'development'

export const nextApp = next({ dev: isDevelopment })
export const nextApp = next({ dev: isDevelopment, conf })
export const nextHandleRequest = nextApp.getRequestHandler()
await nextApp.prepare()

Expand Down
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
Expand Down
Loading

0 comments on commit 4e4b2d2

Please sign in to comment.