cs531-f19 / discussions

Discussions board for CS 431/531 Web Server Design course
2 stars 12 forks source link

Getting a new test file tarball everytime the image is built #41

Open bwmabe opened 5 years ago

bwmabe commented 5 years ago

Just wondering if it's okay to fetch a new copy of the cs-531-test-files.tar.gz every time the docker image is built.

That's what I am doing at the moment but if that's not allowed or not recommended I'll change it to use a copy in my own repository.

I have a line in the Dockerfile to fetch a new copy of the tarball with wget and then another to extract it to the current directory.

Thanks!

ibnesayeed commented 5 years ago

It is fine to download remotely, but your system will be more resilient and self-contained if you keep the copy of the tar.gz file in a sample directory and extract it in the document root when the image is built. Do not keep pre-extracted files in the repo, because Git cannot track empty folders, so some tests might fail.

You can take inspiration from how I did it in my sample code at https://github.com/ibnesayeed/cs531-webserver. You will notice that I have used ADD directive which is more powerful than COPY in the sense it automatically extracts local tarballs and compressed files and downloads files if the source is a URI. However, it does not combine the two features (i.e., downloading remote files and extracting/decompressing them) for security reasons. Read more about COPY vs. ADD.