I'm using the `Docker` flow storage with `base_ima...
# prefect-community
d
I'm using the
Docker
flow storage with
base_image
, and need to add a file to the image which can only be determined at registration time (flow.storage assignment). I've tried various combinations of
build_kwargs
and
extra_dockerfile_commands
but am not having any luck. Would appreciate any feedback or pointers!
Copy code
my_new_file = "/valid/path/to/file.json"
flow.storage = Docker( 
    base_image=valid_image_name,
    local_image=True,
    ignore_healthchecks=True,
    build_kwargs={'my_new_file': my_new_file}, 
    extra_dockerfile_commands=['ARG my_new_file', 
                               'COPY $my_new_file .'])
Once it gets to the COPY command I get the error
Copy code
COPY failed: stat /data/docker/tmp/docker-builder092360870/valid/path/to/file.json: no such file or directory
I've also tried just the basename of the file as input into the build_kwargs, with no avail. How do I get a file into that temporary docker builder dir? Cheers
v
Have you tried using the
files
kwarg in the Docker object constructor?
d
I have. it doesn't copy them anywhere obvious.
(or anywhere at all; I did a find from / in the container and the file wasn't anywhere.)
v
I have used the
files
kwarg where I provide a dictionary of source and target locations. ie.
Copy code
"/home/user/file":"/inputs/file"
Where the new file location is explicitly set.
Usually during build it will also print out which files are being copied .
d
I'll try again.
are you using a base_image?
ok! it worked.
🙏 🙏
👍 1