Ensure Docker agent builds stay static (#597)
This commit is contained in:
parent
cdba742884
commit
e1fe8354e9
3 changed files with 10 additions and 2 deletions
|
|
@ -29,11 +29,13 @@ Grab the `pulse-docker-agent` binary from the release assets (or build it yourse
|
|||
```bash
|
||||
# Build from source
|
||||
cd /opt/pulse
|
||||
GOOS=linux GOARCH=amd64 go build -o pulse-docker-agent ./cmd/pulse-docker-agent
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pulse-docker-agent ./cmd/pulse-docker-agent
|
||||
```
|
||||
|
||||
Copy the binary to your Docker host (e.g. `/usr/local/bin/pulse-docker-agent`) and make it executable.
|
||||
|
||||
> **Why `CGO_ENABLED=0`?** Building a fully static binary ensures the agent runs on hosts still using older glibc releases (for example Debian 11 with glibc 2.31).
|
||||
|
||||
### Quick install from your Pulse server
|
||||
|
||||
Use the bundled installation script (ships with Pulse v4.22.0+) to deploy and manage the agent. Replace the token placeholder with an API token generated in **Settings → Security**. Create a dedicated token for each Docker host so you can revoke individual credentials without touching others—sharing one token across many hosts makes incident response much harder.
|
||||
|
|
|
|||
|
|
@ -786,9 +786,12 @@ WantedBy=multi-user.target`;
|
|||
<code>
|
||||
cd /opt/pulse
|
||||
<br />
|
||||
GOOS=linux GOARCH=amd64 go build -o pulse-docker-agent ./cmd/pulse-docker-agent
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o pulse-docker-agent ./cmd/pulse-docker-agent
|
||||
</code>
|
||||
</div>
|
||||
<p class="text-xs text-gray-500 dark:text-gray-400">
|
||||
Building with <code class="font-mono text-[11px]">CGO_ENABLED=0</code> keeps the binary fully static so it runs on hosts with older glibc (e.g. Debian 11).
|
||||
</p>
|
||||
<p class="font-medium text-gray-900 dark:text-gray-100">2. Copy to host</p>
|
||||
<div class="rounded bg-gray-900 p-3 font-mono text-xs text-gray-100 dark:bg-gray-950">
|
||||
<code>
|
||||
|
|
|
|||
|
|
@ -10,6 +10,9 @@ if [ -x /usr/local/go/bin/go ]; then
|
|||
export PATH=/usr/local/go/bin:$PATH
|
||||
fi
|
||||
|
||||
# Force static binaries so release artifacts run on older glibc hosts
|
||||
export CGO_ENABLED=0
|
||||
|
||||
VERSION=${1:-$(cat VERSION)}
|
||||
BUILD_DIR="build"
|
||||
RELEASE_DIR="release"
|
||||
|
|
|
|||
Loading…
Reference in a new issue