@@ -170,6 +170,17 @@ def setup_docker_image(args) -> tuple[int, str]:
170
170
171
171
docker_image = args .docker_image
172
172
173
+ if (
174
+ docker_image
175
+ and args .base_docker_image
176
+ and args .base_docker_image is not DEFAULT_DOCKER_IMAGE
177
+ ):
178
+ xpk_print (
179
+ '`--base-docker-image` and --docker-image can not be used together.'
180
+ ' Please see `--help` command for more details.'
181
+ )
182
+ xpk_exit (1 )
183
+
173
184
if not docker_image and args .base_docker_image :
174
185
docker_image = args .base_docker_image # fallback for legacy users
175
186
@@ -183,27 +194,18 @@ def setup_docker_image(args) -> tuple[int, str]:
183
194
re .match (prefix , docker_image ) for prefix in CLOUD_PREFIXES
184
195
)
185
196
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
-
197
+ if (
198
+ args .script_dir and args .script_dir != DEFAULT_SCRIPT_DIR
199
+ ) or not is_cloud_image :
196
200
validate_code = validate_docker_image (docker_image , args )
197
201
if validate_code != 0 :
198
202
xpk_exit (validate_code )
199
-
203
+ build_code , docker_image = build_docker_image_from_base_image (args )
204
+ if build_code != 0 :
205
+ xpk_exit (build_code )
200
206
else :
201
207
validate_code = validate_docker_image (docker_image , args )
202
208
if validate_code != 0 :
203
209
xpk_exit (validate_code )
204
210
205
- build_code , docker_image = build_docker_image_from_base_image (args )
206
- if build_code != 0 :
207
- xpk_exit (build_code )
208
-
209
211
return 0 , docker_image
0 commit comments