Start your next.js project in seconds
This project is based on Next.js 9.2.1 (Server side rendering react framwork). react-int (multilanguage) ready.
Live: https://app.malithpriyashandev.vercel.app/
Make sure you have npm installed.
git clone [email protected]:malithmcr/next.js-boilerplate.git & cd app
- Run
npm i
- Start the dev server using
npm run dev
Visit http://localhost:3000 on your browser
docker-compose up
NGINX listens on port 80, which is the default HTTP port, so you can just visit http://localhost/
# Build images
docker build --tag nextjs-image .
docker build --tag nginx-image ./nginx
# Create shared network
docker network create my-network
# Run containers
docker run --network my-network --name nextjs-container nextjs-image
docker run --network my-network --link nextjs-container:nextjs --publish 80:80 nginx-image
Next.js container is referenced inside NGINX container as nextjs
.
npm run dev
- start the dev servernpm run build
- create a production ready buildnpm start
- start production servernpm staging
- start staging server
PM2 commands can still be used inside a container with the docker exec
command:
docker exec -it <container-id> pm2 monit # Monitoring CPU/Usage of each process
docker exec -it <container-id> pm2 list # Listing managed processes
docker exec -it <container-id> pm2 show # Get more information about a process
docker exec -it <container-id> pm2 reload all # 0sec downtime reload all applications
####Running tests
npm run test:watch
####Deploying the app
npm run build
npm install -g now
cd app && now