From 292e525539617dfcfc71d78bd06b82cc54cbad14 Mon Sep 17 00:00:00 2001 From: Matt Hook Date: Mon, 22 May 2023 15:18:23 +1200 Subject: [PATCH] Revert "build/makefile fixes from develop (#8926)" This reverts commit 65d609861314b20bc5fc56124c9ab24ba6b82dcb. --- build/build_binary.ps1 | 20 +++++++++++++++----- build/build_binary.sh | 17 +++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/build/build_binary.ps1 b/build/build_binary.ps1 index 831a969de..5dcb8175f 100644 --- a/build/build_binary.ps1 +++ b/build/build_binary.ps1 @@ -1,7 +1,17 @@ -param ( - [string]$platform, - [string]$arch -) + +$ErrorActionPreference = "Stop"; + +$binary = "portainer.exe" +$project_path = $((Get-Location).Path) + +New-Item -Name dist -Path "$project_path" -ItemType Directory | Out-Null +Set-Location -Path "$project_path\api\cmd\portainer" + +# copy templates +Copy-Item -Path "./mustache-templates" -Destination "./dist" -Recurse -$ErrorActionPreference = "Stop"; \ No newline at end of file +C:\go\bin\go.exe get -t -d -v ./... +C:\go\bin\go.exe build -v + +Move-Item -Path "$($binary)" -Destination "..\..\..\dist" diff --git a/build/build_binary.sh b/build/build_binary.sh index eba453e58..0b81d9941 100755 --- a/build/build_binary.sh +++ b/build/build_binary.sh @@ -2,6 +2,11 @@ set -x +DEBUG=${DEBUG:-""} +if [ -n "$DEBUG" ]; then + set -x +fi + mkdir -p dist # populate tool versions @@ -22,14 +27,14 @@ go get -t -d -v ./... # the build takes 2 seconds GOOS=$1 GOARCH=$2 CGO_ENABLED=0 go build \ - -trimpath \ - --installsuffix cgo \ - --ldflags "-s \ +-trimpath \ +--installsuffix cgo \ +--ldflags "-s \ --X 'github.com/portainer/portainer/api/build.BuildNumber=${BUILDNUMBER}' \ --X 'github.com/portainer/portainer/api/build.ImageTag=${CONTAINER_IMAGE_TAG}' \ --X 'github.com/portainer/portainer/api/build.NodejsVersion=${NODE_VERSION}' \ --X 'github.com/portainer/portainer/api/build.YarnVersion=${YARN_VERSION}' \ --X 'github.com/portainer/portainer/api/build.WebpackVersion=${WEBPACK_VERSION}' \ - --X 'github.com/portainer/portainer/api/build.GoVersion=${GO_VERSION}'" \ - -o "../dist/portainer" \ - ./cmd/portainer/ +--X 'github.com/portainer/portainer/api/build.GoVersion=${GO_VERSION}'" \ +-o "../dist/portainer" \ +./cmd/portainer/