I keep getting errors while running google cloud j...
# ask-community
a
I keep getting errors while running google cloud job runs because of the container I am building. I suppose cloudrun jobs require a specific platform. Would be great if someone who did that earlier can help with a sample dockerfile. Thanks.
r
Hello ! I can help with that, here’s the Dockerfile I use :
Copy code
FROM python:3.11

ADD requirements.txt requirements.txt
ADD flows/ flows/
ADD serve_flows.py serve_flows.py
ARG PREFECT_API=<http://localhost:4200>
ENV PREFECT_API_URL=$PREFECT_API
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh pip3 install -r requirements.txt
ADD entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh

CMD ["./entrypoint.sh"]
You have to pass the PREFECT_API variable at building time like this :
Copy code
docker build -t prefect-agent --build-arg PREFECT_API=<http://you-api-url:4200/api> .
a
thanks @Robin Niel I feel I'm still doing something wrong, will check again
r
Well obviously you can get rid off some stuff that’s specific to our infra but i’m running self hosted. You might have to configure authentication if you’re using prefect cloud
a
yes, self hosted setup is working fine for us. for cloud, I think I require some way to start prefect engine
r
Main difference between self hosted and cloud should only be PREFECT_API_URL and authentication
a
google cloud job runs also require something different I think
r
Well I meant self hosting server and worker
I’m running cloud run jobs for workflows, server and worker are hosted on a server