deployment/docker/Makefile: rename EXTRA_ENVS to EXTRA_DOCKER_ENVS

The purpose of EXTRA_DOCKER_ENVS name is more clear than EXTRA_ENVS.

While at it, make the following small fixes:

- Pass GOARM=5 to Docker builder when building Docker packages for GOARCH=arm in the same way
  it is passed to the builder when building production binaries for GOARCH=arm.
  See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4965

- Set GCO_ENABLED=1 for package-via-docker-amd64, which has been accidentally removed in 07496d7d92

- Consistently use 'CGO_ENABLED=... GOARCH=...' order of env vars at package-via-docker-*,
  because this order is used in app-via-docker-*

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6158
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/pull/6172

This is a follow-up for 07496d7d92 and 7958f38864
This commit is contained in:
Aliaksandr Valialkin 2024-05-12 22:23:28 +02:00
parent 8466ab109c
commit cb19335a9f
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -102,22 +102,22 @@ run-via-docker: package-via-docker
app-via-docker-goos-goarch: app-via-docker-goos-goarch:
APP_SUFFIX='-$(GOOS)-$(GOARCH)' \ APP_SUFFIX='-$(GOOS)-$(GOARCH)' \
DOCKER_OPTS='--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=$(GOOS) --env GOARCH=$(GOARCH) $(foreach v,$(EXTRA_ENVS),--env $(v))' \ DOCKER_OPTS='--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=$(GOOS) --env GOARCH=$(GOARCH) $(foreach v,$(EXTRA_DOCKER_ENVS),--env $(v))' \
$(MAKE) app-via-docker $(MAKE) app-via-docker
app-via-docker-pure: app-via-docker-pure:
APP_SUFFIX='-pure' DOCKER_OPTS='--env CGO_ENABLED=0' $(MAKE) app-via-docker APP_SUFFIX='-pure' DOCKER_OPTS='--env CGO_ENABLED=0' $(MAKE) app-via-docker
app-via-docker-linux-amd64: app-via-docker-linux-amd64:
EXTRA_ENVS='CC=/opt/cross-builder/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc' \ EXTRA_DOCKER_ENVS='CC=/opt/cross-builder/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc' \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(MAKE) app-via-docker-goos-goarch CGO_ENABLED=1 GOOS=linux GOARCH=amd64 $(MAKE) app-via-docker-goos-goarch
app-via-docker-linux-arm: app-via-docker-linux-arm:
EXTRA_ENVS='GOARM=5' \ EXTRA_DOCKER_ENVS='GOARM=5' \
CGO_ENABLED=0 GOOS=linux GOARCH=arm $(MAKE) app-via-docker-goos-goarch CGO_ENABLED=0 GOOS=linux GOARCH=arm $(MAKE) app-via-docker-goos-goarch
app-via-docker-linux-arm64: app-via-docker-linux-arm64:
EXTRA_ENVS='CC=/opt/cross-builder/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc' \ EXTRA_DOCKER_ENVS='CC=/opt/cross-builder/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc' \
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 $(MAKE) app-via-docker-goos-goarch CGO_ENABLED=1 GOOS=linux GOARCH=arm64 $(MAKE) app-via-docker-goos-goarch
app-via-docker-linux-ppc64le: app-via-docker-linux-ppc64le:
@ -145,28 +145,29 @@ app-via-docker-windows-amd64:
package-via-docker-goarch: package-via-docker-goarch:
APP_SUFFIX='-$(GOARCH)' \ APP_SUFFIX='-$(GOARCH)' \
DOCKER_OPTS='--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=linux --env GOARCH=$(GOARCH) $(foreach v,$(EXTRA_ENVS),--env $(v))' \ DOCKER_OPTS='--env CGO_ENABLED=$(CGO_ENABLED) --env GOOS=linux --env GOARCH=$(GOARCH) $(foreach v,$(EXTRA_DOCKER_ENVS),--env $(v))' \
$(MAKE) package-via-docker $(MAKE) package-via-docker
package-via-docker-pure: package-via-docker-pure:
APP_SUFFIX='-pure' DOCKER_OPTS='--env CGO_ENABLED=0' $(MAKE) package-via-docker APP_SUFFIX='-pure' DOCKER_OPTS='--env CGO_ENABLED=0' $(MAKE) package-via-docker
package-via-docker-amd64: package-via-docker-amd64:
EXTRA_ENVS='CC=/opt/cross-builder/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc' \ EXTRA_DOCKER_ENVS='CC=/opt/cross-builder/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc' \
GOARCH=amd64 GOARCH=amd64 $(MAKE) package-via-docker-goarch CO_ENABLED=1 GOARCH=amd64 $(MAKE) package-via-docker-goarch
package-via-docker-arm: package-via-docker-arm:
GOARCH=arm CGO_ENABLED=0 $(MAKE) package-via-docker-goarch EXTRA_DOCKER_ENVS='GOARM=5' \
CGO_ENABLED=0 GOARCH=arm $(MAKE) package-via-docker-goarch
package-via-docker-arm64: package-via-docker-arm64:
EXTRA_ENVS='CC=/opt/cross-builder/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc' \ EXTRA_DOCKER_ENVS='CC=/opt/cross-builder/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc' \
CGO_ENABLED=1 GOARCH=arm64 $(MAKE) package-via-docker-goarch CGO_ENABLED=1 GOARCH=arm64 $(MAKE) package-via-docker-goarch
package-via-docker-ppc64le: package-via-docker-ppc64le:
GOARCH=ppc64le CGO_ENABLED=0 $(MAKE) package-via-docker-goarch CGO_ENABLED=0 GOARCH=ppc64le $(MAKE) package-via-docker-goarch
package-via-docker-386: package-via-docker-386:
GOARCH=386 CGO_ENABLED=0 $(MAKE) package-via-docker-goarch CGO_ENABLED=0 GOARCH=386 $(MAKE) package-via-docker-goarch
remove-docker-images: remove-docker-images:
docker image ls --format '{{.ID}}' | xargs docker image rm -f docker image ls --format '{{.ID}}' | xargs docker image rm -f