sagemaker-studio-image-build-cli icon indicating copy to clipboard operation
sagemaker-studio-image-build-cli copied to clipboard

[Question] sm-docker zips and uploads the current dir, not the target dir?

Open athewsey opened this issue 5 years ago • 3 comments

From my investigations into #2, I saw that sm-docker is zipping and uploading the current folder, not the target folder, when a target is given. E.g:

sm-docker build ./docker
# Uploads all of ./ (not just ./docker) to S3

Is this expected and deliberate for some reason? If you have lots of other stuff in your folder it can make for a significantly slower wait than the (also working) cd ./docker && sm-docker build .

athewsey avatar Oct 02 '20 11:10 athewsey

also if the current dir does not have a dockerfile, it will still spin off the codebuild job and fail during the build stage. Suggest checking for a dockerfile first before starting the process

w601sxs avatar Nov 03 '20 22:11 w601sxs

Is this expected and deliberate for some reason?

Hi @athewsey, yes this is expected. See https://github.com/aws-samples/sagemaker-studio-image-build-cli/blob/fb616c091b6c2fdca0c85a970218ff4bd0426440/sagemaker_studio_image_build/builder.py#L34-L40 and this is also explained in the README https://github.com/aws-samples/sagemaker-studio-image-build-cli/blame/master/README.md#L31.

However, your point is valid, as the docker CLI honors the target directory and not the current directory. For e.g., docker build examples/basic_build works without having to "cd" into the directory.

jaipreet-s avatar Dec 15 '20 04:12 jaipreet-s

@w601sxs - Good call, that's a great enhancement.

jaipreet-s avatar Dec 15 '20 04:12 jaipreet-s