I am trying to setup a Google Cloud Run job to run within the container of an already existing dockerized container running a Google Cloud Run service, which runs a gunicorn webserver with the following command in its Dockerfile:
CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
The idea is for the Cloud Run job to run at a fixed schedule like a cron job, leveraging the code already existing for the (web) service, as they are both in Python.
A solution would be to have a completely new container for the Cloud Run job, which only calls a dedicated endpoint on the Cloud Run service, but I am wondering if I can avoid having to create a new container and can instead build the Cloud Run job using the same container as the service?
I’ve naively tried to just use the container and give it the command:
launcher
+ arguments python my_cron_job.py
but I got the error terminated: Application failed to start: "launcher" not found
.