Enables proper handling of multiphase dockerfiles
Using the following dockerfile as an example:
FROM ubuntu AS named-stage
RUN some-command
# stage unnamed
FROM ubuntu
RUN another-command
FROM alpine AS built-appValid flags:
--file | -f: Name of the Dockerfile (Default isPATH/Dockerfile)--prefix | -p: Prefix for unnamed stages (Default isunnamed-)--output-path | -o: Path to output rewritten dockerfile (Default is stdout)
Lists all stages in a dockerfile. If the stage is unnamed, then a temporary stage name is output.
docker-multiphase-handler list-stagesnamed-stage
unnamed-1
built-app
Exit 0 if the specified Dockerfile does not need to be rewritten, exits 1 if it does need to be rewritten
docker-multiphase-handler needs-rewriteRewrites the specified Dockerfile to ensure each stage is named. May reformat dockerfile and remove comments.
docker-multiphase-handler rewriteOutputs the following to stdout.
FROM ubuntu AS named-stage
RUN some-command
FROM ubuntu AS unnamed-1
RUN another-command
FROM alpine AS built-appThe flag --output-path can be specified to specify a path to write it to.