05/08/2023, 9:10 PM
Prefect on Kubernetes with nginx Ingress /prefect To answer my own question of how to run Prefect with nginx on Kubernetes (behind a /prefect ingress) here’s the recipe:
git clone
cd prefect
git checkout 2.10.6
# edit Dockerfile to set `PREFECT_UI_SERVE_BASE=/prefect`
docker build --arg PYTHON_VERSION=3.10 -t prefect:base2.10.6-python3.10 -f Dockerfile  .
Then you need to inherit from this image for building the Prefect agent:
FROM prefect:base2.10.6-python3.10
RUN pip install -r requirements.txt
@justabill I think the Prefect dev team should probably introduce Docker arguments such that it is easier to achieve that without hacking the base image. I can elaborate more here or in DM.


05/08/2023, 10:13 PM
Thanks for sharing the recipe. We've been thinking through the custom Docker image story recently. I'll make sure that the right team sees this.


05/08/2023, 10:21 PM
Sure no problem, thanks for forwarding this and I’m glad to help.
@justabill for reference, other products allow you to configure the prefix or base url through env vars. If you look at Metabase, for example, they provide MB_SITE_URL that end users of the product can configure.
This allows me as a vendor to easily customize the deployment of my 3rd party services through environment variables instead of having to rebase my changes on top of Prefect upstream and keep up with the latest versions.