Michael
09/02/2021, 4:40 PMfiles
and env_vars
attributes as outlined in the Docs. But it seems that my .dockerignore
file (in the directory from which I am registering the flow) is ignored by this build process. I have massive data directories nested at different levels inside the codebase so it’s essential there be a way to include this somehow. Anyone come across this / have any ideas? I’m curious about playing around with a custom Dockerfile, but the code that copies flows to a tmp Dockerfile in create_docker_file
is dynamic so it seems tough that I could write a standalone Dockerfile to handle this case.Kevin Kho
Zach Angell
.dockerignore
in the files
arg for the storage?Michael
09/02/2021, 4:52 PMMichael
09/02/2021, 4:56 PM.dockerignore
is already there because it falls within the directory I’m trying to copy. I just tried to explicitly copy it as a separate files
arg, but same deal.Michael
09/02/2021, 5:00 PMcreate_docker_file
outputted script just has a standard COPY command in it, which I thought was supposed to obey .dockerignore
… Perhaps the build context is not where I think it isZach Angell
Perhaps the build context is not where I think it isYes! (unless you've looked through the internals of Docker storage) When building Docker storage, Prefect creates a temporary directory that contains a new Dockerfile (created by Prefect) and also copies over all your files. For the
.dockerignore
to be respected, it will need to be copied into the root of this temporary directory https://github.com/PrefectHQ/prefect/blob/master/src/prefect/storage/docker.py#L435Zach Angell
Michael
09/02/2021, 5:16 PMZach Angell
files
like so?
files = {
...
"/path/to/.dockerignore": ".dockerignore"
}
Michael
09/02/2021, 5:27 PMDockerfile
that copies the .dockerignore
inside the image, whereas the docker build process needs to read the .dockerignore
file before starting to build (at least, this is how I understand why it doesn’t work)Michael
09/02/2021, 5:28 PM.dockerignore
file automaticallyMichael
09/02/2021, 5:39 PMZach Angell
Docker
storage to respect .dockerignore
file if using files
argument"Marvin
09/02/2021, 5:41 PMMichael
09/03/2021, 11:12 AMcreate_dockerfile_object
copies the specified files into a tmp dir as well as generating the Dockerfile
text. So the docker build isn’t the long part, it’s just a massive shutil.copytree
call that copies my files (the entire current directory) into the tmp directory inside the current directory. It’s frustrating because in my case I shouldn’t have to perform the copy since the files are already within the build context, but I get that it’s designed to allow a user to specify files anywhere, hence the copy to make sure.Zach Angell