Repository: cosmos/relayer
Pull request #1053 (2022-12-01 05:13:57)

Pipe in LDFLAGS env var to enable fully static bin
Fixes https://github.com/cosmos/relayer/actions/runs/3587267089/jobs/6037415594


Patch:
diff --git a/Dockerfile b/Dockerfile
index 2cda6cf..ad850f5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -24,7 +24,7 @@ RUN if [ -d "/go/bin/linux_${TARGETARCH}" ]; then mv /go/bin/linux_${TARGETARCH}
 
 # Use minimal busybox from infra-toolkit image for final scratch image
 FROM ghcr.io/strangelove-ventures/infra-toolkit:v0.0.6 AS busybox-min
-RUN addgroup --gid 1025 -S relayer && adduser --uid 1025 -S relayer -G relayer
+RUN addgroup --gid 1000 -S relayer && adduser --uid 100 -S relayer -G relayer
 
 # Use ln and rm from full featured busybox for assembling final image
 FROM busybox:1.34.1-musl AS busybox-full
@@ -64,7 +64,7 @@ COPY --from=busybox-min /etc/ssl/cert.pem /etc/ssl/cert.pem
 
 # Install relayer user
 COPY --from=busybox-min /etc/passwd /etc/passwd
-COPY --from=busybox-min --chown=1025:1025 /home/relayer /home/relayer
+COPY --from=busybox-min --chown=100:1000 /home/relayer /home/relayer
 
 WORKDIR /home/relayer
 USER relayer
diff --git a/Makefile b/Makefile
index f1ac665..5cafeb1 100644
--- a/Makefile
+++ b/Makefile
@@ -14,9 +14,12 @@ all: lint install
 # Build / Install
 ###############################################################################
 
-LD_FLAGS = -X github.com/cosmos/relayer/v2/cmd.Version=$(VERSION)
+ldflags = -X github.com/cosmos/relayer/v2/cmd.Version=$(VERSION)
 
-BUILD_FLAGS := -ldflags '$(LD_FLAGS)'
+ldflags += $(LDFLAGS)
+ldflags := $(strip $(ldflags))
+
+BUILD_FLAGS := -ldflags '$(ldflags)'
 
 build: go.sum
 ifeq ($(OS),Windows_NT)
diff --git a/go.mod b/go.mod
index 3de9575..a5b4bc1 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	github.com/avast/retry-go/v4 v4.3.1
-	github.com/cosmos/cosmos-sdk v0.46.4
+	github.com/cosmos/cosmos-sdk v0.46.6
 	github.com/cosmos/ibc-go/v5 v5.1.0
 	github.com/gogo/protobuf v1.3.3
 	github.com/google/go-cmp v0.5.9
diff --git a/go.sum b/go.sum
index 6ced755..4498469 100644
--- a/go.sum
+++ b/go.sum
@@ -172,8 +172,8 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
 github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
 github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0=
 github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw=
-github.com/cosmos/cosmos-sdk v0.46.4 h1:I4CPfnz7lAPM7cEvvyTxL1h3M/ugbhTNr5ZRcnW8WsU=
-github.com/cosmos/cosmos-sdk v0.46.4/go.mod h1:b5usG7aBEEvhaatYCdV6orFbDUsj4BG1V6UtKwNcJeQ=
+github.com/cosmos/cosmos-sdk v0.46.6 h1:K9EZsqOZ2jQX3bIQUpn7Hk/YCoaJWRLU56PzvpX8INk=
+github.com/cosmos/cosmos-sdk v0.46.6/go.mod h1:JNklMfXo7MhDF1j/jxZCmDyOYyqhVoKB22e8p1ATEqA=
 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
 github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
 github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
diff --git a/local.Dockerfile b/local.Dockerfile
index c16409f..9a66c5a 100644
--- a/local.Dockerfile
+++ b/local.Dockerfile
@@ -8,7 +8,7 @@ RUN CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"' make instal
 
 # Use minimal busybox from infra-toolkit image for final scratch image
 FROM ghcr.io/strangelove-ventures/infra-toolkit:v0.0.6 AS busybox-min
-RUN addgroup --gid 1025 -S relayer && adduser --uid 1025 -S relayer -G relayer
+RUN addgroup --gid 1000 -S relayer && adduser --uid 100 -S relayer -G relayer
 
 # Use ln and rm from full featured busybox for assembling final image
 FROM busybox:1.34.1-musl AS busybox-full
@@ -48,7 +48,7 @@ COPY --from=busybox-min /etc/ssl/cert.pem /etc/ssl/cert.pem
 
 # Install relayer user
 COPY --from=busybox-min /etc/passwd /etc/passwd
-COPY --from=busybox-min --chown=1025:1025 /home/relayer /home/relayer
+COPY --from=busybox-min --chown=100:1000 /home/relayer /home/relayer
 
 WORKDIR /home/relayer
 USER relayer


Test patch:
diff --git a/ibctest/go.mod b/ibctest/go.mod
index 8ab1a82..f434d96 100644
--- a/ibctest/go.mod
+++ b/ibctest/go.mod
@@ -3,12 +3,12 @@ module github.com/cosmos/relayer/v2/ibctest
 go 1.18
 
 require (
-	github.com/cosmos/cosmos-sdk v0.46.4
+	github.com/cosmos/cosmos-sdk v0.46.6
 	github.com/cosmos/ibc-go/v5 v5.1.0
 	github.com/cosmos/relayer/v2 v2.0.0
 	github.com/docker/docker v20.10.19+incompatible
 	github.com/moby/moby v20.10.18+incompatible
-	github.com/strangelove-ventures/ibctest/v5 v5.0.0-20220922235050-6baac8c666ea
+	github.com/strangelove-ventures/ibctest/v5 v5.0.0-20221201055938-fa49178c17eb
 	github.com/stretchr/testify v1.8.1
 	github.com/tendermint/tendermint v0.34.23
 	go.uber.org/zap v1.23.0
diff --git a/ibctest/go.sum b/ibctest/go.sum
index c2f7cf8..0c6e9cd 100644
--- a/ibctest/go.sum
+++ b/ibctest/go.sum
@@ -351,8 +351,8 @@ github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44=
 github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU=
 github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0=
 github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw=
-github.com/cosmos/cosmos-sdk v0.46.4 h1:I4CPfnz7lAPM7cEvvyTxL1h3M/ugbhTNr5ZRcnW8WsU=
-github.com/cosmos/cosmos-sdk v0.46.4/go.mod h1:b5usG7aBEEvhaatYCdV6orFbDUsj4BG1V6UtKwNcJeQ=
+github.com/cosmos/cosmos-sdk v0.46.6 h1:K9EZsqOZ2jQX3bIQUpn7Hk/YCoaJWRLU56PzvpX8INk=
+github.com/cosmos/cosmos-sdk v0.46.6/go.mod h1:JNklMfXo7MhDF1j/jxZCmDyOYyqhVoKB22e8p1ATEqA=
 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
 github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
 github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
@@ -1084,8 +1084,10 @@ github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+eg
 github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8=
 github.com/strangelove-ventures/go-subkey v1.0.7 h1:cOP/Lajg3uxV/tvspu0m6+0Cu+DJgygkEAbx/s+f35I=
 github.com/strangelove-ventures/go-subkey v1.0.7/go.mod h1:E34izOIEm+sZ1YmYawYRquqBQWeZBjVB4pF7bMuhc1c=
-github.com/strangelove-ventures/ibctest/v5 v5.0.0-20220922235050-6baac8c666ea h1:jQvO399MoK7+NLigd7Vj7lGsa1Y7LWt8uTtbYGPTyYo=
-github.com/strangelove-ventures/ibctest/v5 v5.0.0-20220922235050-6baac8c666ea/go.mod h1:C284t8FhFrldr1BfQHDLsAMMzAWczTgeruePi7M6TmA=
+github.com/strangelove-ventures/ibctest/v5 v5.0.0-20221201053013-48511af0d9a6 h1:s6yvcrgGPVeib5cU1elIp3xJaHiHYOoNwcl7akX6oWM=
+github.com/strangelove-ventures/ibctest/v5 v5.0.0-20221201053013-48511af0d9a6/go.mod h1:erUg63AnIKlEm/A9tcTqNFH50xiOXvZwEm/dYZ7CQKM=
+github.com/strangelove-ventures/ibctest/v5 v5.0.0-20221201055938-fa49178c17eb h1:5ozs6HqJVc0+aFzADexizENc2g7G5+2HKtdBLgW6L2o=
+github.com/strangelove-ventures/ibctest/v5 v5.0.0-20221201055938-fa49178c17eb/go.mod h1:erUg63AnIKlEm/A9tcTqNFH50xiOXvZwEm/dYZ7CQKM=
 github.com/strangelove-ventures/lens v0.6.0 h1:0cs/14rXCh/RRy4A7l15gHPNTSDsHxbfKC1JA1EdOfs=
 github.com/strangelove-ventures/lens v0.6.0/go.mod h1:02mFT/TRg4J76STUzL8Yvne/z5E1ulrjYv5WFhcBXUY=
 github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=