@@ -223,39 +223,39 @@ def setup_docker_image(args) -> tuple[int, str]:
223223 Name of the docker image to use.
224224 """
225225
226- docker_image = args .docker_image
227- if not docker_image or docker_image == DEFAULT_DOCKER_IMAGE :
228- docker_image = args .base_docker_image # fallback for legacy users
229-
230- if not docker_image or docker_image == DEFAULT_DOCKER_IMAGE :
231- xpk_print (" Error: No docker image specified. Please provide --docker-image." )
232- xpk_exit (1 )
233-
234- cloud_prefixes = [
235- " gcr.io" , " docker.pkg.dev" , " us-docker.pkg.dev"
236- ]
237- is_cloud_image = any (docker_image .startswith (prefix ) for prefix in cloud_prefixes )
238-
239- if is_cloud_image :
240- if args .script_dir is not DEFAULT_SCRIPT_DIR :
241- xpk_print (
242- " Error: `--script-dir` cannot be used with a cloud docker image.\n "
243- " Hint: If you need to customize the image with local scripts, "
244- " use a local base image (e.g., `ubuntu:20.04`) instead of a prebuilt cloud image."
245- )
246- xpk_exit (1 )
247-
248- validate_code = validate_docker_image (docker_image , args )
249- if validate_code != 0 :
250- xpk_exit (validate_code )
251-
252- else :
253- validate_code = validate_docker_image (docker_image , args )
254- if validate_code != 0 :
255- xpk_exit (validate_code )
256-
257- build_code , docker_image = build_docker_image_from_base_image (args )
258- if build_code != 0 :
259- xpk_exit (build_code )
260-
261- return 0 , docker_image
226+ docker_image = args .docker_image
227+ if not docker_image or docker_image == DEFAULT_DOCKER_IMAGE :
228+ docker_image = args .base_docker_image # fallback for legacy users
229+
230+ if not docker_image or docker_image == DEFAULT_DOCKER_IMAGE :
231+ xpk_print (' Error: No docker image specified. Please provide --docker-image.' )
232+ xpk_exit (1 )
233+
234+ cloud_prefixes = [
235+ ' gcr.io' , ' docker.pkg.dev' , ' us-docker.pkg.dev'
236+ ]
237+ is_cloud_image = any (docker_image .startswith (prefix ) for prefix in cloud_prefixes )
238+
239+ if is_cloud_image :
240+ if args .script_dir is not DEFAULT_SCRIPT_DIR :
241+ xpk_print (
242+ ' Error: `--script-dir` cannot be used with a cloud docker image.\n '
243+ ' Hint: If you need to customize the image with local scripts, '
244+ ' use a local base image (e.g., `ubuntu:20.04`) instead of a prebuilt cloud image.'
245+ )
246+ xpk_exit (1 )
247+
248+ validate_code = validate_docker_image (docker_image , args )
249+ if validate_code != 0 :
250+ xpk_exit (validate_code )
251+
252+ else :
253+ validate_code = validate_docker_image (docker_image , args )
254+ if validate_code != 0 :
255+ xpk_exit (validate_code )
256+
257+ build_code , docker_image = build_docker_image_from_base_image (args )
258+ if build_code != 0 :
259+ xpk_exit (build_code )
260+
261+ return 0 , docker_image
0 commit comments