Repository: rclone/rclone (language: go)

Issue:
v1.68.0 Docker image build failed
<!--

We understand you are having a problem with rclone; we want to help you with that!

**STOP and READ**
**YOUR POST WILL BE REMOVED IF IT IS LOW QUALITY**:
Please show the effort you've put into solving the problem and please be specific.
People are volunteering their time to help! Low effort posts are not likely to get good answers!

If you think you might have found a bug, try to replicate it with the latest beta (or stable).
The update instructions are available at https://rclone.org/commands/rclone_selfupdate/

If you can still replicate it or just got a question then please use the rclone forum:

    https://forum.rclone.org/

for a quick response instead of filing an issue on this repo.

If nothing else helps, then please fill in the info below which helps us help you.

**DO NOT REDACT** any information except passwords/keys/personal info.

You should use 3 backticks to begin and end your paste to make it readable.

Make sure to include a log obtained with '-vv'.

You can also use '-vv --log-file bug.log' and a service such as https://pastebin.com or https://gist.github.com/

Thank you

The Rclone Developers

-->

#### What is the problem you are having with rclone?

v1.68.0 Docker image build failed. Detailed logs at https://github.com/rclone/rclone/actions/runs/10761410173.

Can it be rebuilt?

#### What is your rclone version (output from `rclone version`)

v1.68.0

<!--- Please keep the note below for others who read your bug report. -->

#### How to use GitHub

* Please use the 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to show that you are affected by the same issue.
* Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
* Subscribe to receive notifications on status change and new comments.



Discussion / hints:
I think this is the error

```
#48 [linux/arm64 builder 5/6] RUN   CGO_ENABLED=0   make
#48 205.2 # cd /go/src/github.com/rclone/rclone; git status --porcelain
#48 205.2 fork/exec /usr/bin/git: invalid argument
#48 205.2 error obtaining VCS status: fork/exec /usr/bin/git: invalid argument
#48 205.2 	Use -buildvcs=false to disable VCS stamping.
#48 205.3 make: *** [Makefile:54: rclone] Error 1
#48 ERROR: process "/bin/sh -c CGO_ENABLED=0   make" did not complete successfully: exit code: 2
```

Not really sure what caused that. That error message `-buildvcs=false to disable VCS stamping.` is a message from the go compiler

Why did it stop working? Was it because we went to go1.23 from go1.22?

Or maybe something simpler like `git` being missing from the build image, or a wrong architecture git.

I suspect changing to docker/build-push-action@v6 like we use for the beta build rather than https://github.com/ilteoood/docker_buildx which we use for historical reasons will fix the problem.

Any thoughts?

In the mean time I can build the docker image manually...
Hi @ncw ,

Thank you for your response.

I forked the project and tried the following:

1. No modifications (**failed**, [logs](https://github.com/ttionya/rclone/actions/runs/10829568358))
2. Using the git version that was used before, git=v2.45.2-r0 (**failed**, [logs](https://github.com/ttionya/rclone/actions/runs/10829665679))
3. Not building to `linux/arm64` platform (**failed**, [logs](https://github.com/ttionya/rclone/actions/runs/10829832178))
4. Building with `golang:1.22-alpine` (**not failed, still building**, [logs](https://github.com/ttionya/rclone/actions/runs/10829985018))
5. Use `docker/build-push-action` instead of `ilteoood/docker_buildx` (**not failed, still building**, [logs](https://github.com/ttionya/rclone/actions/runs/10832095295))

Based on these attempts, I believe the compilation error only occurs with the latest version of Golang (1.23) in combination with `ilteoood/docker_buildx`. I am not sure about the historical reasons for using `ilteoood/docker_buildx`, but I think it would be better to replace it with `docker/build-push-action`.

Since the master branch already includes the content of `v1.69`, I think manually building `v1.68` is a good option.

Fix patch:
diff --git a/.github/workflows/build_publish_release_docker_image.yml b/.github/workflows/build_publish_release_docker_image.yml
index 319ce1b3050c6..b69285a7e5bb8 100644
--- a/.github/workflows/build_publish_release_docker_image.yml
+++ b/.github/workflows/build_publish_release_docker_image.yml
@@ -32,15 +32,27 @@ jobs:
             - name: Get actual major version
               id: actual_major_version
               run: echo ::set-output name=ACTUAL_MAJOR_VERSION::$(echo $GITHUB_REF | cut -d / -f 3 | sed 's/v//g' | cut -d "." -f 1)
+            - name: Set up QEMU
+              uses: docker/setup-qemu-action@v3
+            - name: Set up Docker Buildx
+              uses: docker/setup-buildx-action@v3
+            - name: Login to Docker Hub
+              uses: docker/login-action@v3
+              with:
+                username: ${{ secrets.DOCKER_HUB_USER }}
+                password: ${{ secrets.DOCKER_HUB_PASSWORD }}
             - name: Build and publish image
-              uses: ilteoood/docker_buildx@1.1.0
+              uses: docker/build-push-action@v6
               with:
-                tag: latest,${{ steps.actual_patch_version.outputs.ACTUAL_PATCH_VERSION }},${{ steps.actual_minor_version.outputs.ACTUAL_MINOR_VERSION }},${{ steps.actual_major_version.outputs.ACTUAL_MAJOR_VERSION }}
-                imageName: rclone/rclone
-                platform: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6
-                publish: true
-                dockerHubUser: ${{ secrets.DOCKER_HUB_USER }}
-                dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }}
+                file: Dockerfile
+                context: .
+                platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6
+                push: true
+                tags: |
+                  rclone/rclone:latest
+                  rclone/rclone:${{ steps.actual_patch_version.outputs.ACTUAL_PATCH_VERSION }}
+                  rclone/rclone:${{ steps.actual_minor_version.outputs.ACTUAL_MINOR_VERSION }}
+                  rclone/rclone:${{ steps.actual_major_version.outputs.ACTUAL_MAJOR_VERSION }}
 
     build_docker_volume_plugin:
         if: github.repository == 'rclone/rclone'


Test patch: