Hey folks :wave: If you need need to run `prefect ...
# ask-community
a
Hey folks 👋 If you need need to run
prefect deploy
using Docker deployment model in an CI/CD environment where Python is not available (like my Jenkins CI/CD environment), consider running
prefect deploy
inside a Docker container itself! Doing this, Prefect will still be able to build the Docker image for your flow. Just make sure that the Docker container where you run
prefect deploy
has access to the Docker Engine. One way to do this, is by passing the following volume (tested on Mac):
Copy code
-v /var/run/docker.sock:/var/run/docker.sock
Sharing just in case someone else need it! 🙌
gratitude thank you 4
e
Hey @ale could you share your
deployment.yaml
configuration and cicd commands you run alongside
prefect deploy
? I've been doing exactly this with prefect 2.10.4 but recent versions are not compatible anymore, I get loads of error from the prefect build command, I'm navigating through the docs but an up to date example would be very useful if it's not too much work 🙏
a
Hey @Emma Rizzi 👋 I’m not using Prefect 2 at the moment, I was just trying out
prefect deploy
in a Docker container on my local Mac. So no real production configuration at the moment. However I do have the
prefect.yaml
file I used during the Prefect Associate Course. Please find it below
Copy code
# Welcome to your prefect.yaml file! You can you this file for storing and managing
# configuration for deploying your flows. We recommend committing this file to source
# control along with your flow code.

# Generic metadata about this project
name: pacc-london-2023
prefect-version: 2.10.16

# build section allows you to manage and build docker images
build:
- prefect_docker.deployments.steps.build_docker_image:
    id: build_image
    requires: prefect-docker>=0.3.0
    image_name: mydockerimage
    tag: 0.0.1
    dockerfile: Dockerfile
    push: False

# push section allows you to manage if and how this project is uploaded to remote locations
push:

# pull section allows you to provide instructions for cloning this project in remote locations
pull:
- prefect.deployments.steps.set_working_directory:
    directory: /opt/prefect/pacc-london-2023

# the deployments section allows you to provide configuration for deploying flows
deployments:
- name: myflowdockerdeployment
  version:
  tags: []
  description:
  entrypoint: myflow.py:collect_data
  parameters: {}
  work_pool:
    name: workpooldocker
    work_queue_name:
    job_variables:
      image: '{{ build_image.image }}'
  schedule:
e
Any resource is better than nothing, I'll compare that to my current configuration! Thanks a lot 🙂
a
You’re welcome! Let me know if there’s anything else I can do to help you
☺️ 1