Docker Community Forums

Share and learn in the Docker community.

Single Dockerfile for multi-arch


Multi-stage build and Manifest support are quite helpful, but it still doesn’t solve the Dockerfile maintenance per-arch.

My question is about maintaining separate files for multi-arch, currently, my application runs on Ubuntu 18.04, Ubuntu 16.04 and Ubuntu 16.04-ARM and I am maintaining 3 separate Dockerfiles, with minimal changes, 90% of the content is same,

  • just some packages different from 18.04 to 16.04 and
  • ARM has a different base image.

Every change I make I have to propagate to other Dockerfiles. Is there a way to do this efficiently? Like having a single Dockerfile and protecting changes with base image names and then pass a base image name to docker build?