Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce arlon binary size( issue #233) #247

Merged
merged 3 commits into from
Sep 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ clean:
rm -rf ./testbin; rm -rf ./bin

build: generate fmt vet cluster-config ## Build manager binary.
go build -o bin/arlon main.go
go build --ldflags="-s -w" -o bin/arlon main.go
ShaunakJoshi1407 marked this conversation as resolved.
Show resolved Hide resolved

cluster-config:
mkdir -p bin
tar cvfz bin/setup_arlon.tar.gz ./setup_arlon.sh ./config/crd/bases/*.yaml ./deploy/manifests/*.yaml ./testing/manifests/*.yaml

# goreleaser can invoke this target to produce binaries for different OS and CPU arch combinations
build-cli: fmt vet ## Build CLI binary (with the current OS and CPU architecture) from the go env.
go build -o bin/arlon -ldflags '$(LD_FLAGS)' main.go
go build -o bin/arlon -ldflags '$(LD_FLAGS) -s -w' main.go

build-cli-linux: fmt vet ## Build CLI binary for Linux
GOOS=linux GOARCH=amd64 go build -o bin/arlon -ldflags '$(LD_FLAGS)' main.go
GOOS=linux GOARCH=amd64 go build -o bin/arlon -ldflags '$(LD_FLAGS) -s -w' main.go

build-cli-mac-amd64: fmt vet ## Build CLI binary for Mac (AMD/ Intel CPU)
GOOS=darwin GOARCH=amd64 go build -o bin/arlon -ldflags '$(LD_FLAGS)' main.go
GOOS=darwin GOARCH=amd64 go build -o bin/arlon -ldflags '$(LD_FLAGS) -s -w' main.go

build-cli-mac-arm64: fmt vet ## Build CLI binary for Mac (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o bin/arlon -ldflags '$(LD_FLAGS)' main.go
GOOS=darwin GOARCH=arm64 go build -o bin/arlon -ldflags '$(LD_FLAGS) -s -w' main.go

ifeq (GOARCH,"arm64")
build-cli-mac: build-cli-mac-arm64
Expand All @@ -96,7 +96,7 @@ endif

# Arlon has not been tested on Windows yet.
build-cli-win: fmt vet ## Build CLI binary for Windows.
GOOS=windows GOARCH=amd64 go build -o bin/arlon -ldflags '$(LD_FLAGS)' main.go
GOOS=windows GOARCH=amd64 go build -o bin/arlon -ldflags '$(LD_FLAGS) -s -w' main.go

run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go
Expand Down