A Dockerfile is a text document that contains all the commands a user could call on the command line to assemble an image. Using docker build users can create an automated build that executes several command-line instructions in succession.
To see a very basic example of a Dockerfile and what each line with relates to, see this page Basic Dockerfile Example
Multi Stage Example
When creating docker images, it is important to keep image sizes and also number of layers small. To do this we build images in multiple stages.
For example, using an image with SDK to run the build, then copying the resulting slimmed down output onto the final image in one single action (i.e. only one additional layer).
To see how we do this with the Corporate Website, see this page
Useful links on multistage Builds:
See Sitecore pages on Multi Stage Builds here: Build Sitecore solutions
See Dockers pages on Multi Stage Builds here: Use multi-stage builds