From 8e5ef5503d2ae7a17b7c716d56b0f5bbeb47e851 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Thu, 14 Aug 2025 01:49:35 +0200 Subject: [PATCH] fix(ci): docker build (#10914) * fix(ci): pass -buildvcs=false to go list in Makefile Docker builds were failing because go list commands in mk/golang.mk didn't inherit GOFLAGS from the environment, causing empty package names when .git directory was incomplete. This issue always existed but was masked until recent changes in GitHub Actions runners or Docker golang image exposed it. * fix(ci): use modern ENV key=value format in Dockerfile Fixes Docker build deprecation warnings. --- Dockerfile | 8 ++++---- mk/golang.mk | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index d2924f2b7..310f97a93 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.24 AS builder ARG TARGETOS TARGETARCH -ENV SRC_DIR /kubo +ENV SRC_DIR=/kubo # Download packages first so they can be cached. COPY go.mod go.sum $SRC_DIR/ @@ -47,7 +47,7 @@ RUN set -eux; \ FROM busybox:stable-glibc # Get the ipfs binary, entrypoint script, and TLS CAs from the build container. -ENV SRC_DIR /kubo +ENV SRC_DIR=/kubo COPY --from=utilities /usr/sbin/gosu /sbin/gosu COPY --from=utilities /usr/bin/tini /sbin/tini COPY --from=utilities /bin/fusermount /usr/local/bin/fusermount @@ -74,7 +74,7 @@ EXPOSE 8080 EXPOSE 8081 # Create the fs-repo directory and switch to a non-privileged user. -ENV IPFS_PATH /data/ipfs +ENV IPFS_PATH=/data/ipfs RUN mkdir -p $IPFS_PATH \ && adduser -D -h $IPFS_PATH -u 1000 -G users ipfs \ && chown ipfs:users $IPFS_PATH @@ -93,7 +93,7 @@ RUN mkdir /container-init.d \ VOLUME $IPFS_PATH # The default logging level -ENV GOLOG_LOG_LEVEL "" +ENV GOLOG_LOG_LEVEL="" # This just makes sure that: # 1. There's an fs-repo, and initializes one if there isn't. diff --git a/mk/golang.mk b/mk/golang.mk index 3b32a65f9..ce765a294 100644 --- a/mk/golang.mk +++ b/mk/golang.mk @@ -26,10 +26,10 @@ TEST_GO := TEST_GO_BUILD := CHECK_GO := -go-pkg-name=$(shell $(GOCC) list $(go-tags) github.com/ipfs/kubo/$(1)) +go-pkg-name=$(shell GOFLAGS=-buildvcs=false $(GOCC) list $(go-tags) github.com/ipfs/kubo/$(1)) go-main-name=$(notdir $(call go-pkg-name,$(1)))$(?exe) go-curr-pkg-tgt=$(d)/$(call go-main-name,$(d)) -go-pkgs=$(shell $(GOCC) list github.com/ipfs/kubo/...) +go-pkgs=$(shell GOFLAGS=-buildvcs=false $(GOCC) list github.com/ipfs/kubo/...) go-tags=$(if $(GOTAGS), -tags="$(call join-with,$(space),$(GOTAGS))") go-flags-with-tags=$(GOFLAGS)$(go-tags)