Skip to content

Clarify .dockerignore usage in README #1341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ jobs:
tags: user/app:latest
```

Be careful because **any file mutation in the steps that precede the build step
will be ignored, including processing of the `.dockerignore` file** since
Copy link
Member

Choose a reason for hiding this comment

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

I think this is already self-explanatory that .dockerignore is ignored with Git context here. We also say that Path context should be used in next sentence if you don't want this behavior.

Copy link
Author

Choose a reason for hiding this comment

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

@crazy-max I personally thought the text was saying file mutations in general and file mutations of the .dockerignore file specifically weren't supported with git context (not that .dockerignore wasn't supported at all in git context). I've updated this with another revision to try to improve the clarity for others. Let me know if I can improve it further. If you don't feel it warrants an update, feel free to close the PR. Thanks!

the context is based on the Git reference. However, you can use the
[Path context](#path-context) using the [`context` input](#inputs) alongside
the [`actions/checkout`](https://github.com/actions/checkout/) action to remove
this restriction.
**Important Considerations for Git Context**

* **File Mutations** perfomred during your workflow will **not** be reflected in the final Docker image.

* **.dockerignore** is ignored altogether when using git context.

You can remove these limitations by using the [path context](#path-context) input alongside the [`actions/checkout`](https://github.com/actions/checkout/) action.

Default Git context can also be provided using the [Handlebars template](https://handlebarsjs.com/guide/)
expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
Expand Down