Consider the following docker build context:
src/
hi
there
bye
and Dockerfile:
FROM ubuntu
RUN mkdir test
COPY src/hi src/there test/
This works just fine but I would like to make the list of files to copy an ARG
, something like:
FROM ubuntu
ARG files
RUN mkdir test
COPY ${files} test/
Unfortunately calling with docker build --build-arg files='src/hi src/there' some_path
fails because it treats src/hi src/there
as a single item. How can I "expand" the files
argument into multiple files to copy?
On a whim I tried specifying the files arg multiple times: docker build --build-arg files='src/hi' --build-arg files='src/there' some_path
, but this only copies "there".