-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Get version from the first argument | ||
version=$1 | ||
|
||
docker build -t vprodemo.azurecr.io/rpc-go:v$version . | ||
|
||
# Build for Linux | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X 'rpc/pkg/utils.ProjectVersion=$version'" -trimpath -o rpc_linux_x64 ./cmd/main.go | ||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -X 'rpc/pkg/utils.ProjectVersion=$version'" -trimpath -o rpc_linux_x86 ./cmd/main.go | ||
|
||
# Build for Windows | ||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X 'rpc/pkg/utils.ProjectVersion=$version'" -trimpath -o rpc_windows_x64.exe ./cmd/main.go | ||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -X 'rpc/pkg/utils.ProjectVersion=$version'" -trimpath -o rpc_windows_x86.exe ./cmd/main.go | ||
|
||
# Build library for Linux | ||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -trimpath -buildmode=c-shared -o rpc.so.$version ./cmd | ||
|
||
# Mark the Unix system outputs as executable | ||
chmod +x rpc_linux_x64 | ||
chmod +x rpc_linux_x86 | ||
|
||
# Add them to tar files respectively | ||
tar cvfpz rpc_linux_x64.tar.gz rpc_linux_x64 | ||
tar cvfpz rpc_linux_x86.tar.gz rpc_linux_x86 | ||
tar cvfpz rpc_linux_x86.tar.gz rpc_linux_x86 | ||
tar cvfpz rpc_so_x64.tar.gz rpc.so.$version | ||
|
||
# Add Windows build to a zip file | ||
zip rpc_windows_x64.zip rpc_windows_x64.exe | ||
zip rpc_windows_x86.zip rpc_windows_x86.exe |