Planning the layout of our App

A Dockerfile configuration file specifies the steps required to build and run a bespoke application in an image that can be launched as a Docker container.

Some developers create two Dockerfiles. One for development that is optimized for debugging and one for production that is optimized for speed and security. However, in this example, you will create:

  1. A single Dockerfile for production use.
  2. A single docker-compose.yml that uses the production image but overrides the settings for development purposes.

This should require less effort and fewer system resources.

๐Ÿ“Œ You could use Docker Compose on your production server and define a specific configuration file, e.g., docker-compose-production.yml.

Dockerfile

A Dockerfile defines the build steps required to install and execute an application in order to create a ready-to-run image.

Itโ€™s common to start with a base image from Docker Hub. This application requires a Node.js image:

Get hands-on with 1200+ tech skills courses.