nextjs-pkg-docker-alpine
nextjs-pkg-docker-alpine copied to clipboard
📥Deploy a commercial Next.js application with pkg and docker.
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/
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