I have to create a Dockerfile to copy certain zip files. Assume the files are
/opt/source
A.zip
B.zip
C.zip
D.zip
Dockerfile
When building Dockerfile, I will be passing the file names as an argument in arraylist format, as below:
docker build -t mch --build-arg arg1="A.zip B.zip C.zip D.zip" --no-cache .
The crux is file names can vary each time when building the Dockerfile; for example, only A, B and C file will only be available or sometime more file will be available or at times there could be zip files that shouldn't be copied at all. Only the ones mentioned in the argument should be picked.
How could I complete file to iterate through arg1 arraylist to copy the files from local to container while building? Different approach on this are welcome.
My Dockerfile contains:
# The official Red Hat registry and the base image
FROM registry.access.redhat.com/ubi8/ubi:8.2
ARG arg1
RUN yum install -y unzip && \
yum install -y procps && \
mkdir -p /opt/dict
WORKDIR /opt/dict
COPY $arg1 .