docker / build-push-action

GitHub Action to build and push Docker images with Buildx

Home Page:https://github.com/marketplace/actions/build-and-push-docker-images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No support for git-lfs

roim opened this issue · 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: docker/hub-feedback#500

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 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 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.

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?

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?

Are there any updates on this? :)

Any updates on this?

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

commented

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.