O'Reilly logo

Hands-On Microservices with Node.js by Diogo Resende

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Defining a Dockerfile

This is a file specification with instructions for Docker to create an image. The instructions are clear and allow you to share that file on several servers so that Docker builds the image.

Our Dockerfile will have three parts:

  • The header, which indicates the base image and author
  • The instructions to build the image
  • The instructions to run the image

There are many more instructions that we'll probably not cover. To get to know Dockerfile better, head over and read the documentation. This is an introduction that will actually help you go a long way. Here's our first Dockerfile:

FROM node:alpineMAINTAINER Diogo ResendeADD imagini /opt/appWORKDIR /opt/appRUN npm iCMD [ "node", "/opt/app/imagini" ]

The empty lines were ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required