Rolf Schick
12/15/2020, 3:21 PMJim Crist-Harif
12/15/2020, 3:24 PMfiles
parameter to the Docker
class
• Pass a custom dockerfile
that manually adds your files to the Docker
class
• Pre-build a new base image that already has your files added, then pass in that image as base_image
to Docker
.Rolf Schick
12/15/2020, 3:32 PMJim Crist-Harif
12/15/2020, 3:40 PMI tried now relativ and absolute paths with the docker “COPY” command, but unfortunately Prefect still adds the prefix “/var/lib/docker/tmp/docker-builder994084773” before the path, resulting in an Error.Sorry, are you saying this happened with a custom dockerfile? Or using the
files
arg to Docker
?Rolf Schick
12/15/2020, 3:47 PMRolf Schick
12/15/2020, 3:49 PMJim Crist-Harif
12/15/2020, 3:53 PMRolf Schick
12/15/2020, 3:59 PMJim Crist-Harif
12/15/2020, 4:25 PM$ tree
.
├── Dockerfile
├── flow.py
└── samplefolder
└── testfile
1 directory, 3 files
$ cat Dockerfile
FROM prefecthq/prefect:latest-python3.8
COPY samplefolder/. /opt/app/great_expectations/
$ cat flow.py
from prefect import Flow, task
from prefect.environments.storage import Docker
@task
def hello():
print("hello")
with Flow("example") as flow:
hello()
flow.storage = Docker(dockerfile="Dockerfile")
flow.register("testing")
$ python flow.py
...
Successfully built fcc4916c9281
Successfully tagged example:2020-12-15t16-23-44-416437-00-00
Flow URL: <https://cloud.prefect.io/jim-prefectio/flow/1debc0b1-aa7b-42b1-b6df-97051786279c>
└── ID: 38ad0ce0-f222-432e-860e-c2fec8ac21eb
└── Project: testing
└── Labels: []
Jim Crist-Harif
12/15/2020, 4:27 PMpython flow.py
from) as the build context, rather than creating a temporary directory.Rolf Schick
12/15/2020, 4:29 PM