Skip to content

Latest commit

History

History
47 lines (32 loc) 路 1.22 KB

README.md

File metadata and controls

47 lines (32 loc) 路 1.22 KB

Nextjs-pkg-docker-alpine

Deploy a commercial Next.js application with pkg and docker.
Medium article: Deploy a commercial Next.js application with pkg and docker

Demo

https://nextjs-pkg-docker-alpine.now.sh/

Deploy to now

Install and Build

$ yarn install
$ yarn run dev

# Build pkg
$ yarn run build
$ yarn run pkg

# Execute the binary
NODE_ENV=production ./pkg/nextjs-pkg-docker-alpine

Docker Alpine

$ docker build -t nextjs-pkg-docker-alpine .
$ docker run --rm -it \
  -p 3003:3003 \
  -e "PORT=3003" \
  -e "API_URL=https://API_URL.com" \
  nextjs-pkg-docker-alpine

Note: It might take some time to fetch base Node.js binaries to PKG_CACHE_PATH during the pkg process.

Deploy to Now

$ now --docker

License

MIT 漏 Michael Hsu