Skip to content

Conversation

@luigibk
Copy link
Contributor

@luigibk luigibk commented Aug 25, 2020

Description

There is currently no way to specify (or override) the .dockerignore file in the acr build command. This prevents multiple Dockerfile(s) to share the same context effectively.

This change allows different Dockerfiles to define different subsets of the context files with different ignore rules.
In case the docker file is not named Dockerfile, the frontend (i.e. acr build) first checks for <path/to/docker_file_name>.dockerignore and if it is found it will be used instead of the root .dockerignore.

This is consistent with the docker behaviour implemented in:
moby/buildkit#901

For more information see the related issue #14811

Testing Guide
No command changes. This PR affects the acr build command, when the -f <docker_file_name> option is used.

History Notes

[acr] Add support for dockerignore override


This checklist is used to make sure that common guidelines for a pull request are followed.

@yungezz
Copy link
Member

yungezz commented Aug 26, 2020

hi @fengzhou-msft could you pls help to review this? thanks

@northtyphoon
Copy link
Member

@shahzzzam @juliusl @rosanch

ignore_list, ignore_list_size = _load_dockerignore_file(source_location)
# NOTE: os.path.basename is unable to parse "\" in the file path
original_docker_file_name = os.path.basename(docker_file_path.replace("\\", "/"))
ignore_list, ignore_list_size = _load_dockerignore_file(source_location, original_docker_file_name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is ignore_list_size used? do you think its redundant to return that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shahzzzam, thanks for your comment. It looks like it's used in:

https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/acr/_archive_utils.py#L107

I am not sure if it would be appropriate to refactor that, but I personally see that as out of scope for this PR. Please let me know if you have suggestions in that sense.

@luigibk
Copy link
Contributor Author

luigibk commented Sep 7, 2020

Hi @juliusl and @shahzzzam did you have a chance to have a look at my commit and replies to your comments?

@juliusl
Copy link
Member

juliusl commented Sep 8, 2020

LGTM, LGTY @shahzzzam ?

Copy link
Contributor

@shahzzzam shahzzzam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luigibk
Copy link
Contributor Author

luigibk commented Sep 14, 2020

Hi @northtyphoon, what's the next step for this? Am I waiting for another review?

@yungezz
Copy link
Member

yungezz commented Sep 14, 2020

hi @fengzhou-msft, could you pls help to review the PR? thanks

1 similar comment
@yungezz
Copy link
Member

yungezz commented Sep 14, 2020

hi @fengzhou-msft, could you pls help to review the PR? thanks

@fengzhou-msft fengzhou-msft merged commit febe0b2 into Azure:dev Sep 15, 2020
@luigibk luigibk deleted the dockerignore-override-support branch September 15, 2020 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants