Skip to content

Commit

Permalink
Build static binary (#405)
Browse files Browse the repository at this point in the history
* Use env to execute bash.

This makes it work on other platforms than Linux.

Signed-off-by: Ville Valkonen <weezelding@gmail.com>

* Build static binary.

While here, add flags that remove debug symbols and build related paths
from the binary. This reduces size from ~8MB to ~5MB.

Signed-off-by: Ville Valkonen <weezelding@gmail.com>

* Build binary by using the existing shell script.

Signed-off-by: Ville Valkonen <weezelding@gmail.com>

Signed-off-by: Ville Valkonen <weezelding@gmail.com>
  • Loading branch information
weezel authored Oct 9, 2022
1 parent 7f42ba1 commit 1524ea8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions build_binary.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash

CURRENT_VERSION=`git describe`
go build -ldflags "-X main.version=$CURRENT_VERSION" cmd/teleirc.go
CGO_ENABLED=0 go build -asmflags -trimpath \
-ldflags "-s -w -X main.version=$CURRENT_VERSION" cmd/teleirc.go

2 changes: 1 addition & 1 deletion docs/user/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ This section is only required if you are building a binary from source:

1. Clone repository (`git clone https://github.com/RITlug/teleirc.git`)
1. Enter repository (`cd teleirc/`)
1. Build binary (`go build cmd/teleirc.go`)
1. Build binary (`./build_binary.sh`)

#### Configuration

Expand Down

0 comments on commit 1524ea8

Please sign in to comment.