Open tspearconquest opened 7 months ago
After performing the git checkout, buildkit doesn't keep the .git
directory by default. You can keep it by using the --keep-git-dir=true
flag:
https://docs.docker.com/engine/reference/builder/#adding-a-git-repository-add-git-ref-dir
That should resolve your issue :tada:
Hi, please reopen and read the provided dockerfile where I used this flag already and demonstrated that the checkout is not happening.
Under the FROM scratch as clone-extensions
layer, I am already using the flag...
Apologies @tspearconquest, I read through too quickly :heart:
@tonistiigi is there a reason we couldn't swap from git checkout FETCH_HEAD
to git checkout ${ref}
here?
Or is there a deliberate reason we should be in a detached HEAD state?
@jedevc Ref does not need to mean branch, #tag
, #pull/NR/head
, #sha
are all valid as well. But I agree that for branches, the current current branch should be set as well.
Hi,
I'm trying to build Zed Attack Proxy inside a docker container.
My dockerfile is as follows:
Built with:
DOCKER_BUILDKIT=1 docker build --progress=plain --build-arg BUILDER_VERSION=11.0.21_9 --build-arg BUILDER_TYPE="-jdk-alpine" --build-arg PACKAGE_VERSION=v2.14.0 --build-arg IMAGE_VERSION=stable -t zaproxy:test .
This results in buildkit running
git branch
during the build and showing that themain
branch has been cloned but not checked out, so we're not sitting on any branch. I would have expected for the main branch to be checked out.Unfortunately, the fact that no branch was checked out breaks the gradle build of the addons, because it depends on being on a checked-out branch. Thus, when you remove the debugging commands and build, the following is output:
I looked through the docs but did not find any method to make buildkit
ADD
do a checkout after cloning the main branch. Is this a bug or by design? If by design, can support be added, possibly with another flag like--checkout=<true|false>
where the default is false?