@@ -170,6 +170,13 @@ def setup_docker_image(args) -> tuple[int, str]:
170
170
171
171
docker_image = args .docker_image
172
172
173
+ if docker_image and args .base_docker_image and args .base_docker_image is not DEFAULT_DOCKER_IMAGE :
174
+ xpk_print (
175
+ '`--base-docker-image` and --docker-image can not be used together.'
176
+ ' Please see `--help` command for more details.'
177
+ )
178
+ xpk_exit (1 )
179
+
173
180
if not docker_image and args .base_docker_image :
174
181
docker_image = args .base_docker_image # fallback for legacy users
175
182
@@ -183,27 +190,16 @@ def setup_docker_image(args) -> tuple[int, str]:
183
190
re .match (prefix , docker_image ) for prefix in CLOUD_PREFIXES
184
191
)
185
192
186
- if is_cloud_image :
187
- if args .script_dir is not DEFAULT_SCRIPT_DIR :
188
- xpk_print (
189
- 'Error: `--script-dir` cannot be used with a cloud docker'
190
- ' image.\n Hint: If you need to customize the image with local'
191
- ' scripts, use a local base image (e.g., `ubuntu:20.04`) instead of a'
192
- ' prebuilt cloud image.'
193
- )
194
- xpk_exit (1 )
195
-
193
+ if (args .script_dir and args .script_dir != DEFAULT_SCRIPT_DIR ) or not is_cloud_image :
196
194
validate_code = validate_docker_image (docker_image , args )
197
195
if validate_code != 0 :
198
196
xpk_exit (validate_code )
199
-
197
+ build_code , docker_image = build_docker_image_from_base_image (args )
198
+ if build_code != 0 :
199
+ xpk_exit (build_code )
200
200
else :
201
201
validate_code = validate_docker_image (docker_image , args )
202
202
if validate_code != 0 :
203
203
xpk_exit (validate_code )
204
204
205
- build_code , docker_image = build_docker_image_from_base_image (args )
206
- if build_code != 0 :
207
- xpk_exit (build_code )
208
-
209
205
return 0 , docker_image
0 commit comments