https://prefect.io logo
Title
e

Emma Rizzi

04/14/2023, 8:19 AM
Hi again, still testing the new projects feature! What's the pull step needed when building a docker image with
push:True
to a private registry ? Right now, my flow is built and push, the
flow.py
is inside the docker image, and I tried to configure the pull step with
prefect.projects.steps.set_working_directory
but I get
FileNotFoundError: [Errno 2] No such file or directory: '/opt/prefect/flow'
It seems that the pull step is executed outside of the docker container ? my code in thread
1
Dockerfile
FROM xxx/prefect:base-3.10-0.1

COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY ./* /opt/prefect/flow/
prefect.yaml
name: flow
prefect-version: 2.10.4

build:
- prefect_docker.projects.steps.build_docker_image:
    requires: prefect-docker>0.1.0
    image_name: xxx/orion
    tag: test-1.0
    dockerfile: Dockerfile
    push: True
    credentials: "{{ prefect.blocks.docker-registry-credentials.docker-hub }}"

pull:
- prefect.projects.steps.set_working_directory:
    directory: /opt/prefect/flow
deployment.yaml
# base metadata
name: hello-world-deploy
version: null
tags: []
description: null
schedule: null

# flow-specific fields
#flow_name: check
entrypoint: flow.py:check
path: null
parameters: {}
parameter_openapi_schema: null

# infra-specific fields
work_pool:
  name: wekeo-pool
  work_queue_name: default
  job_variables: {}
c

Chris White

04/17/2023, 7:36 PM
Hi @Emma Rizzi! You might benefit from the
--recipe
flag on
prefect project init
which will guide you to a proper setup (in your case,
prefect project init --recipe docker
is probably what you want). The reason this error is happening is because you haven't configured your image to get used anywhere; assuming you are using either a docker or kubernetes worker, you can add the following to
deployment.yaml
and it should begin working:
# infra-specific fields
work_pool:
  name: wekeo-pool
  work_queue_name: default
  job_variables:
    image: "{{ image_name }}"
the image name variable comes from your
build_docker_image
step
e

Emma Rizzi

04/18/2023, 6:29 AM
@Chris White thanks i started another thread here, sorry i forgot to close this one! that was exactly the problem 🙂