When building a project of mine, I first build a docker image and then build the project on it. Currently I have a Docker.file (3 lines) which defines the image to build.
Is it possible to defined the content of a Dockerfile inline with the build command? This way I could get rid of the Dockerfile and probably even work with vars from the shell so I can change my base image dynamically.
Can I build a Dockerfile without having it predefined as an actual file?
You can stream dockerfile content to standard input. docker build -
.
You can create a temporary directory, in which you create a dockerfile file, and use that directory to docker build
.
Is it possible to defined the content of a Dockerfile inline with the build command?
Yes.