build-push-action icon indicating copy to clipboard operation
build-push-action copied to clipboard

No support for git-lfs

Open roim opened this issue 3 years ago • 9 comments

Behaviour

Steps to reproduce this issue

  1. Set up a repository with files tracked by git-lfs (e.g. add a png image to a repo and git lfs track "*.png").
  2. COPY those files in your Dockerfile.
  3. Use this action to build that Dockerfile.

Expected behaviour

Docker image contains the file tracked by git-lfs.

Actual behaviour

Docker image contains the git-lfs pointer.

Configuration

Happens on the current README config.

More

  1. This is extra confusing because any actions/checkout runs with lfs: true are ignored since this action is doing its own checkout. E.g. see this on stack overflow--there are several other reports scattered around.

  2. Separately, DockerHub also lacks git-lfs support, that is mentioned in its docs and also in this Issue: https://github.com/docker/hub-feedback/issues/500

roim avatar Mar 03 '21 10:03 roim

As a mitigation, this action uses whatever is checked out with actions/checkout@v2 which can be configured to use lfs: https://github.com/elgohr/Publish-Docker-Github-Action

roim avatar Mar 03 '21 10:03 roim

@roim Do you have a link to your repo for repro please? You can use the Path context (with checkout action) in the meantime.

crazy-max avatar Mar 03 '21 10:03 crazy-max

@crazy-max it's a private one but I can set up a public repro tomorrow. And thanks for the tip on path context, I'll test it but that should work as a cleaner mitigation.

roim avatar Mar 03 '21 11:03 roim

Repro here: https://github.com/roim/docker-action-lfs

Check how a cat on the image tracked by lfs yields the lfs pointer: https://github.com/roim/docker-action-lfs/runs/2027422788?check_suite_focus=true

That said, passing a custom context, and setting up an lfs checkout beforehand, will work.

I'm sure it's not practical to support every git extension, but lfs is fairly standard and supported by the github checkout action. Maybe an example or comment in the readme would be enough?

roim avatar Mar 04 '21 02:03 roim

Ok looks like it's not implemented on buildkit. Would need a specific option to enable this feature. The command would look like git lfs install --local. WDYT @tonistiigi?

crazy-max avatar Mar 09 '21 18:03 crazy-max

Are there any updates on this? :)

geokaragiannis avatar Jun 15 '21 15:06 geokaragiannis

Any updates on this?

Mluckydwyer avatar Feb 24 '22 21:02 Mluckydwyer

For anyone else with this issue, see this repo for a workaround: https://github.com/roim/docker-action-lfs

Mluckydwyer avatar Feb 24 '22 21:02 Mluckydwyer

For anyone else with this issue, see this repo for a workaround: https://github.com/roim/docker-action-lfs

Thanks, made my day. context: . was the trick.

cupcakearmy avatar Nov 20 '22 22:11 cupcakearmy