chore(dev): update build scripts to support mac (darwin) [r8s-588] (#1279)

This commit is contained in:
Ali
2025-10-07 13:36:17 +13:00
committed by GitHub
parent 7a618311d6
commit eee15d5ff2
2 changed files with 11 additions and 11 deletions

View File

@@ -1,9 +1,3 @@
# See: https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63
# For a list of valid GOOS and GOARCH values
# Note: these can be overriden on the command line e.g. `make PLATFORM=<platform> ARCH=<arch>`
PLATFORM=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)
# build target, can be one of "production", "testing", "development"
ENV=development
WEBPACK_CONFIG=webpack/webpack.$(ENV).js
@@ -37,10 +31,6 @@ build-image: build-all ## Build the Portainer image locally
build-storybook: ## Build and serve the storybook files
yarn storybook:build
devops: clean deps build-client ## Build the everything target specifically for CI
echo "Building the devops binary..."
@./build/build_binary_azuredevops.sh "$(PLATFORM)" "$(ARCH)"
##@ Build dependencies
.PHONY: deps server-deps client-deps tidy
deps: server-deps client-deps ## Download all client and server build dependancies

View File

@@ -55,7 +55,17 @@ ldflags="-s -X 'github.com/portainer/liblicense.LicenseServerBaseURL=https://api
echo "$ldflags"
GOOS=${1:-$(go env GOOS)} GOARCH=${2:-$(go env GOARCH)} CGO_ENABLED=0 go build \
# See: https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63
# For a list of valid GOOS and GOARCH values
PLATFORM=${1:-$(go env GOOS)}
ARCH=${2:-$(go env GOARCH)}
# if the default platform is darwin, set it to linux to allow it to run in the portainer/base image (which doesn't support darwin)
if [ "$PLATFORM" = "darwin" ]; then
PLATFORM="linux"
fi
GOOS=${PLATFORM} GOARCH=${ARCH} CGO_ENABLED=0 go build \
-trimpath \
--installsuffix cgo \
--ldflags "$ldflags" \