I have a Dockerfile like this:
FROM ubuntu:16.04
:
:
RUN git clone <url>
:
Sometimes, the repo that I want to clone is too large.
So, before running this
git clone
command, I would like to check whether the repo that I want to clone, exists in the current directory( directory of dockerfile ) and if it does, then I would do aCOPY <repo-name> .
instruction instead of theRUN git clone <url>
instruction.
I want to achieve something like this:
FROM ubuntu:16.04
:
:
if exists <repo-name>
COPY <repo-name>
else
RUN git clone <url>
:
Is it even possible? If not, are there any tricks that I can do to achieve this?