Include Keyword to use partial Dockerfiles
Hi guys,
maybe I'm doing something wrong but I was really missing one feature.
As a programmer I always have the goal to work DRY. Unfortunately if I need a specific part of Dockerfile-code in multiple Dockerfiles, I have to copy it around.
It would be great if there wouldbe an INCLUDE keyword I could use in my Dockerfile.
Example:
FROM alpine:latest
COPY . /var/my-dir
INCLUDE ./Dockerfile.partial
[...]
And this partial Dockerfile contains regular Dockerfile code. My current workaround is loading a bash script which is not as nice as using Dockerfile syntax.
Best regards Ron
+1 this would be a useful addition.
Could you stop at a specific build stage then use the intermediate image as the starting point in another dockerfile?
https://docs.docker.com/build/building/multi-stage/#stop-at-a-specific-build-stage