Another question about Docker type deployments: I'...
# ask-community
a
Another question about Docker type deployments: I'm building a docker deployment using a custom Dockerfile but during deployment run I'm getting the following error:
Copy code
Jan 31 at 17:44:22.184
17:44:22.100 | INFO    | Flow run 'amber-kingfisher' - Downloading flow code from storage at '.'
Jan 31 at 17:44:22.189
17:44:22.183 | DEBUG   | Flow run 'amber-kingfisher' - Importing flow code from 'bbchatops/prefect/flows/crtsh.py:crtsh_subdomain_discovery_flow'
Jan 31 at 17:44:22.259
17:44:22.252 | ERROR   | Flow run 'amber-kingfisher' - Flow could not be retrieved from deployment.
Traceback (most recent call last):
  File "<frozen importlib._bootstrap_external>", line 879, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1016, in get_code
  File "<frozen importlib._bootstrap_external>", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/bbchatops/prefect/flows/crtsh.py'

The above exception was the direct cause of the following exception:
In the custom Dockerfile I'm copying my code (which lives in the
bbchatops
folder) to root path
/
and I've also tried
/opt/prefect
as well but still getting the same error. Where should the flow code live within the container so that it's picked up successfully?
b
Hey Antreas 👋 What are you using to deploy your flow (
.deploy()
or
prefect.yaml
)? What does your Dockerfile look like?
a
I'm using
.deploy()
and here's my Dockerfile
Copy code
FROM prefecthq/prefect:3-python3.10
WORKDIR /opt/prefect
COPY . .

RUN pip install poetry
RUN poetry install
Okay this is fixed now. Here's how I was able to solve it in case anyone is having the same issue. Basically if you are using modal as infrastructure, for docker type deployments modal will pull your image and then build a new image on top of it. In my case I was using the "latest" image tag which resulted in cloning the image the first time, however it seems that there is some sort of caching layer in modal which prevented puling the new "latest" image hence I was always running my flow in the obsolete docker container for which the path was wrong, even though the "latest" tag in my container registry was pointing to the correct image. To fix that I used the sha1 of the head in the image tag instead which changed every time I pushed a change.
🙌 2
💡 1
b
Thank you for sharing, Antreas! 🚀 ✨