File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 741741)
742742WEBRTC_MODAL_RTSP_PLACEHOLDER = os .getenv ("WEBRTC_MODAL_RTSP_PLACEHOLDER" )
743743WEBRTC_MODAL_RTSP_PLACEHOLDER_URL = os .getenv ("WEBRTC_MODAL_RTSP_PLACEHOLDER_URL" )
744+ WEBRTC_MODAL_IMAGE_FROM_GCP = str2bool (
745+ os .getenv ("WEBRTC_MODAL_IMAGE_FROM_GCP" , "False" )
746+ )
744747HTTP_API_SHARED_WORKFLOWS_THREAD_POOL_ENABLED = str2bool (
745748 os .getenv ("HTTP_API_SHARED_WORKFLOWS_THREAD_POOL_ENABLED" , "True" )
746749)
Original file line number Diff line number Diff line change 2727 WEBRTC_MODAL_FUNCTION_MIN_CONTAINERS ,
2828 WEBRTC_MODAL_FUNCTION_SCALEDOWN_WINDOW ,
2929 WEBRTC_MODAL_FUNCTION_TIME_LIMIT ,
30+ WEBRTC_MODAL_IMAGE_FROM_GCP ,
3031 WEBRTC_MODAL_IMAGE_NAME ,
3132 WEBRTC_MODAL_IMAGE_TAG ,
3233 WEBRTC_MODAL_RESPONSE_TIMEOUT ,
5859
5960if modal is not None :
6061 docker_tag : str = WEBRTC_MODAL_IMAGE_TAG if WEBRTC_MODAL_IMAGE_TAG else __version__
61- # https://modal.com/docs/reference/modal.Image
62- video_processing_image = (
63- modal .Image .from_registry (f"{ WEBRTC_MODAL_IMAGE_NAME } :{ docker_tag } " )
64- .pip_install ("modal" )
65- .entrypoint ([])
66- )
62+ if WEBRTC_MODAL_IMAGE_FROM_GCP :
63+ # https://modal.com/docs/reference/modal.Secret#from_name
64+ secret = modal .Secret .from_name ("SERVICE_ACCOUNT_JSON" )
65+ # https://modal.com/docs/reference/modal.Image#from_gcp_artifact_registry
66+ video_processing_image = (
67+ modal .Image .from_gcp_artifact_registry (
68+ f"{ WEBRTC_MODAL_IMAGE_NAME } :{ docker_tag } " ,
69+ secret = secret ,
70+ )
71+ .pip_install ("modal" )
72+ .entrypoint ([])
73+ )
74+ else :
75+ video_processing_image = (
76+ modal .Image .from_registry (f"{ WEBRTC_MODAL_IMAGE_NAME } :{ docker_tag } " )
77+ .pip_install ("modal" )
78+ .entrypoint ([])
79+ )
6780
6881 # https://modal.com/docs/reference/modal.Volume
6982 rfcache_volume = modal .Volume .from_name ("rfcache" , create_if_missing = True )
You can’t perform that action at this time.
0 commit comments