Skip to content

Problems with Git LFS and docker/build-push-action #161

Open
@gugulet-hu-spreadai

Description

Multirepo is only pulling the Git LFS pointers from child repos, not the actual files. Even when lfs: true and the command git lfs pull is used in the Workflow. The build works locally, but not inside the docker/build-push-action.

The shortened workflow file:

...
               - name: GIT LFS Pull
                 run: cd .; git checkout main && git pull && git lfs pull; ls -alh temp_dir/child-repo/src

               - name: Build and Push
                 uses: docker/build-push-action@v5
                 with:
                      context: .
                      platforms: linux/amd64,linux/arm64
                      push: true
                      tags: ${{ steps.meta.outputs.tags }}
                      labels: ${{ steps.meta.outputs.labels }}
                      cache-from: type=gha
                      cache-to: type=gha,mode=max
                      build-args: |
                           GithubAccessToken=${{ secrets.GithubAccessToken }}
...

The run: cd .; git checkout main && git pull && git lfs pull; ls -alh child-repo/src returns a folder with the images correctly pulled in temp_dir.

But in the dockerfile, after multirepo has run the image files are now just pointers. This breaks the site that is produced:

FROM --platform=$BUILDPLATFORM python:3 AS build

WORKDIR /usr/src/app/internal

ARG GithubAccessToken

COPY internal/requirements.txt .
RUN apt-get update && apt-get install -y apt-transport-https
RUN pip3 install --no-cache-dir -r requirements.txt

COPY . /usr/src/app/

RUN ls -alh temp_dir/child-repo/src

RUN mkdocs build

RUN ls -alh temp_dir/child-repo/src
...

Is there any way to add git lfs pull along with shallow clones of the child repos? This should preferably be an option for people using Git LFS.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions