skrawczyk
06/14/2023, 8:55 PMprefecthq/prefect:2-python3.8-kubernetes
image
pretty simple dockerfile, we just pull down your image, remove existing pip packages, and install our own based on the requirements.txt
file we maintain.
# syntax=docker/dockerfile:1
FROM prefecthq/prefect:2-python3.8-kubernetes
ADD ./Prefect /home/prefect/storage/repo-files
#RUN chmod 777 -R /home/prefect/storage/repo-files/
RUN pip install --upgrade pip \
&& pip freeze > /home/prefect/storage/repo-files/current_packages.txt \
&& pip uninstall -r /home/prefect/storage/repo-files/current_packages.txt -y \
&& rm /home/prefect/storage/repo-files/current_packages.txt \
&& pip install -e /home/prefect/storage/repo-files
One thing to note is that since we use openshift, we had some permissions issues with cloning our git repo to the image, and found a work around by overriding the PREFECT_HOME environment variable to generic /home/prefect
directory
after that fix, the Image is working fine when we are deploying images via git cloning, but another team member starting to look into deploying with the API using the local paths of python files we're already storing on the image in the ADD layer.
when I build the image locally, I see the directory structure created as specified as shown in the first attached screenshot. When we check the directory structure of pods spun up by our worker however, the files do no exist there. Actually nothing exists under /home/prefect/
. I also notice from these docs that there is a PREFECT_LOCAL_STORAGE_PATH env var that should be set as PREFECT_LOCAL_STORAGE_PATH='${PREFECT_HOME}/storage'
(hence why I added our files to a directory underneath that location in the dockerfile). Trying to confirm what that value got set to on the pod returns an empty string as shown in the other attached screenshot.
questions here are
• why do we not see our files on the pod when we know the local image has them? Is it possible that since we write these files there before the pod spins up and PREFECT_HOME is overwritten, the dir gets purged during spin up?
• why do we not see a value for the PREFECT_LOCAL_STORAGE_PATH
on the pod? is that related to not being able to see the files?
• is there a better or recommended way to achieve running flow deployments with local files on an image?skrawczyk
06/15/2023, 6:42 PM