0

Using the ADD command in a Dockerfile, I am trying to download the entire content of a folder to an image.

FROM centos:7

RUN yum -y install httpd

ADD https://github.com/ricardoandre97/docker-en-resources/tree/master/docker-images/templates/startbootstrap-freelancer-master/ /temp/
RUN cp /temp/startbootstrap-freelancer-master/ /var/www/html/

CMD apachectl -DFOREGROUND

Now, the folder /temp contains a file (not a folder!) named startbootstrap-freelancer-master.

As described in here https://stackoverflow.com/questions/66187161/download-a-folder-from-github-with-docker-add[][1], I cannot use the alpine command, since I am in centos:

RUN svn export https://github.com/...

I tried with curl:

RUN curl -L https://github.com/ricardoandre97/docker-en-resources/tree/master/docker-images/templates/startbootstrap-freelancer-master/

but I don't find where it downloaded.

  • 1
    It should be in `/temp/` inside the isolated image filesystem. You might be running into trouble with the following line, which tries to `COPY` from `./temp/` on the host system and isn't finding it. `RUN cp ...` (or `RUN mv ...`) might be what you're looking for in that case. [How to use COPY command in Docker build?](https://stackoverflow.com/questions/39481276/how-to-use-copy-command-in-docker-build) describes this specific problem. – David Maze Apr 02 '23 at 11:20
  • Totally true. Even if the ADD command worked, the COPY command isn't what I intended to do. In this case it would be improper. I am going to edit the snippet. – Domenico Spidy Tamburro Apr 02 '23 at 13:35

1 Answers1

0

You are trying to get a specific dir from github with ADD. It is like wgeting the address and copying it to the image. It is not working that way. There is a long discussion here.

A solution would be to git clone all the repo, keep what you want, and remove unwanted parts.

Andromeda
  • 1,205
  • 1
  • 14
  • 21