Get the parent directory and put all of those contents into the build

i’m using docker for a few things at the moment, and want to improve the workflow.

Basically, I have a project folder, and in this folder I have different programs and scripts etc.

project/

I want a Dockerfile that I can put in this folder (as above), or in a subfolder (as above) that will install the programs themselves. For instance, in the above, I want to run the dockerfile in the subfolder, and have it install and run script.py.

The installing and running is fine, but currently I am doing this:

  1. Zip all of the project directory
  2. Store it somewhere static on my computer
  3. Change the dockerfile to ADD this zip file to my docker build
  4. Unzip on the built machine

This is time consuming, and I need to remember to update the zip file every time I want to test a change. It would be much easier if the script said “Get the parent directory and put all of those contents into the build”. I don’t know how to do this. Is there a way to do this?

I think the command you are looking for is something like

ADD . /data

which will add all the files from the build context (ie, the directory that you’re running docker build . from) to the image’s /data dir.

">