ale
06/30/2023, 8:59 AMprefect 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):
-v /var/run/docker.sock:/var/run/docker.sock
Sharing just in case someone else need it! 🙌Emma Rizzi
07/04/2023, 3:06 PMdeployment.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 🙏ale
07/04/2023, 3:12 PMprefect 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
# 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:
Emma Rizzi
07/04/2023, 3:14 PMale
07/04/2023, 3:15 PM