1

I'd like to be able to control the source of a file (Java Archive) in a Dockerfile which is either a download (with curl) or a local file on the same machine I build the Docker image.

I'm aware of ways to control RUN statements, e.g. Conditional ENV in Dockerfile, but since I need access to the filesystem outside the Docker build image, a RUN statement won't do. I'd need a conditional COPY or ADD or a workaround.

I'm interested in built-in Docker functions/features which avoid the use of more than one Dockerfile or wrapping the Dockerfile in a script using templating software (those just workarounds popping into my head).

Kalle Richter
  • 8,008
  • 26
  • 77
  • 177

1 Answers1

-1

you can use multi-stage build which is rather new in docker:

https://docs.docker.com/develop/develop-images/multistage-build/

eran meiri
  • 1,322
  • 3
  • 12
  • 29
  • I worked through the capabilities and don't have an idea how a conditional reading from local filesystem (as opposed to the alternative to download an artifact) could be acchieved with multistage builds. Please elaborate. – Kalle Richter Jan 31 '19 at 15:29