From 32b45112f43dd4af1c3ecebacbc02d9fcb6c65a5 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sun, 7 Feb 2021 15:04:07 +0000 Subject: [PATCH] Add information on how to build statically Fix #14576 Signed-off-by: Andrew Thornton --- docs/content/doc/installation/from-source.en-us.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/content/doc/installation/from-source.en-us.md b/docs/content/doc/installation/from-source.en-us.md index bff206a86213..5525faf3d574 100644 --- a/docs/content/doc/installation/from-source.en-us.md +++ b/docs/content/doc/installation/from-source.en-us.md @@ -186,3 +186,11 @@ CC=aarch64-unknown-linux-gnu-gcc GOOS=linux GOARCH=arm64 TAGS="bindata sqlite sq ``` Replace `CC`, `GOOS`, and `GOARCH` as appropriate for your architecture target. + +You will sometimes need to build a static compiled image. To do this you will need to add: + +``` +LDFLAGS="-linkmode external -extldflags '-static' $LDFLAGS" TAGS="netgo osusergo $TAGS" make build +``` + +This can be combined with `CC`, `GOOS`, and `GOARCH` as above.