Skip to content

Build context resolved as remote git checkout -> Git LFS pointer files in build context (refs docker/bake-action#488) #7000

Description

@zeckson

Contributing guidelines and issue reporting guide

Well-formed report checklist

  • I have found a bug that the documentation does not mention anything about my problem
  • I have found a bug that there are no open or closed issues that are related to my problem
  • I have provided version/information about my environment and done my best to provide a reproducer

Description of bug

Bug description

When using docker/setup-buildx-action@v4 + docker/bake-action@v7 in GitHub Actions, a build context that points to a subdirectory containing Git LFS-tracked files gets resolved by BuildKit as a remote git context. This bypasses Git LFS smudge filters and exposes pointer files (containing "version https://git-lfs.github.com/spec/v1") inside the build context, causing builds to fail when Dockerfiles detect pointer files.

Environment

  • Workflow: https://github.com/zeckson/mykapitel.ru (.github/workflows/smoke-test.yml)
  • Actions: actions/checkout@v6 (with lfs: true), docker/setup-buildx-action@v4, docker/bake-action@v7
  • Works with: setup-buildx-action@v3 + bake-action@v5

Reproduction steps

  1. Use actions/checkout@v6 with lfs: true so runner workspace has smudged LFS files.
  2. Set up buildx using docker/setup-buildx-action@v4 and invoke docker/bake-action@v7 with context pointing to a subdirectory (e.g., ./docker).
  3. BuildKit/bake resolves the subdirectory context via a remote git fetch which returns raw Git LFS pointer files instead of smudged objects.

Expected

  • When the runner workspace already has LFS objects checked out, bake/buildx should use the local smudged files for a local workspace context or offer a clear option to force local context usage so builds do not inadvertently use remote git checkouts that skip smudge filters.

Observed

  • The file seen inside the build context is a Git LFS pointer and the build fails (example: "Error: akeeba-backup.zip is a Git LFS pointer, not the actual file.").

Failure log excerpt

  • COPY docker/akeeba-backup.zip /tmp/backup.zip
  • RUN if grep -q "version https://git-lfs.github.com/spec/v1" /tmp/backup.zip; then echo "Error: akeeba-backup.zip is a Git LFS pointer, not the actual file." && exit 1; fi && unzip -t /tmp/backup.zip && unzip /tmp/backup.zip -d /app && rm /tmp/backup.zip

Additional info

I can provide the exact workflow file, Dockerfile from the failing run, or open a minimal repro PR if that helps.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions