Ensure Docker agent builds stay static (#597)

This commit is contained in:
rcourtman 2025-10-22 21:48:57 +00:00
parent cdba742884
commit e1fe8354e9
3 changed files with 10 additions and 2 deletions

View file

@ -29,11 +29,13 @@ Grab the `pulse-docker-agent` binary from the release assets (or build it yourse
```bash ```bash
# Build from source # Build from source
cd /opt/pulse 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. 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 ### 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. 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.

View file

@ -786,9 +786,12 @@ WantedBy=multi-user.target`;
<code> <code>
cd /opt/pulse cd /opt/pulse
<br /> <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> </code>
</div> </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> <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"> <div class="rounded bg-gray-900 p-3 font-mono text-xs text-gray-100 dark:bg-gray-950">
<code> <code>

View file

@ -10,6 +10,9 @@ if [ -x /usr/local/go/bin/go ]; then
export PATH=/usr/local/go/bin:$PATH export PATH=/usr/local/go/bin:$PATH
fi fi
# Force static binaries so release artifacts run on older glibc hosts
export CGO_ENABLED=0
VERSION=${1:-$(cat VERSION)} VERSION=${1:-$(cat VERSION)}
BUILD_DIR="build" BUILD_DIR="build"
RELEASE_DIR="release" RELEASE_DIR="release"