Use docker-compose to co-develop a NextJS app

Raveesh Agarwal
2 min readSep 5, 2020

Tell me your story. You are ready to create your next application. Have installed the latest version of node, then yarn, and are now ready to chant the main incantation:

yarn create next-app
oh Voldermot you!

Good for you! But now you want to share this with your new team member. What if they last updated their NodeJS environments in Node 6 days?

Well, fear not my friend, here is the docker-compose.yml file you need to include in your folder(the one that contains package.json):

version: '3'
services:
node:
image: "node:14-alpine"
user: "node"
working_dir: /home/node/app
environment:
- NODE_ENV=development
volumes:
- ./:/home/node/app
ports:
- "80:3000"
command: sh -c "yarn; yarn dev;"

Now let me teach you how to teach your friends a new incantation. Tell your friends that the right steps for them to experience a flawlessly awesome development experience is:

  1. Clone the repo
  2. cd into the directory
  3. Make sure they have a wand whose core is made of the whiskers of a friendly whale (muggle translation: docker, and docker-compose are installed)
  4. and repeat with me:
docker-compose up -d
hermoine level — sensei!

Check it out and let me know how it worked!

IMPORTANT: Do not use this to deploy. Maybe another visit to professor Dumbledore’s office will reveal how to do that, but later.

--

--

Raveesh Agarwal

Entrepreneur, software craftsman and technology enthusiast, I continue to solve problems and grow with my projects, partnerships and endeavors.