-
Notifications
You must be signed in to change notification settings - Fork 560
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
Feature request: Allow specifying subdirectory with default git context #460
Comments
Indeed. I guess we could provide a magic var for this, then you could do: - uses: docker/build-push-action@v2
with:
context: "{{defaultContext}}:spam" |
Since v0.9.0 of BuildKit (BuildX v0.7.0) you can provide a subdirectory to the default Git context. Closes docker#460 Closes docker#528
Since v0.9.0 of BuildKit (BuildX v0.7.0) you can provide a subdirectory to the default Git context. Closes docker#460 Closes docker#528 Signed-off-by: Jim Brännlund <jimbrannlund@fastmail.com>
Since v0.9.0 of BuildKit (BuildX v0.7.0) you can provide a subdirectory to the default Git context. Closes docker#460 Closes docker#528 Signed-off-by: Jim Brännlund <jimbrannlund@fastmail.com>
Since v0.9.0 of BuildKit (BuildX v0.7.0) you can provide a subdirectory to the default Git context. Closes docker#460 Closes docker#528 Signed-off-by: Jim Brännlund <jimbrannlund@fastmail.com>
IMO this is still way too hard to get right...
Ideally the UX could be something like this:
Or maybe:
|
The suggested workaround doesn't work for private repos.
When I tried this, I get the following error.
I suspect because it's a private repository, it doesn't work. I guess will work only with public repos. |
Yes, for private repositories, you'll probably need to add credentials from an appropriate environment variable to the URL. |
@PiDelport Do you have an example on how to add credentials to the URL? |
@simensol you can use this for Private repos
|
When using git repository contexts, Docker allows specifying a subdirectory using the syntax
<repo>#<ref>:<subdir>
, as documented here:BuildKit used to not support this feature, but as of BuildKit 0.9.0, it does:
Can this action add support for this, to avoid the need to use checkouts to build subdirectories?
Workaround
For the time being, specifying a full git context seems to work; for example, to build subdirectory
spam
:However, this doesn't use the same logic for determining the default git context as the action does, so it might be fragile.
The text was updated successfully, but these errors were encountered: