[lxc-devel] [crio-lxc/master] Add static build support

CajuM on Github lxc-bot at linuxcontainers.org
Mon May 13 09:47:36 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 425 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190513/0dc3f693/attachment.bin>
-------------- next part --------------
From f57179a22407eff45829e4a2d3901655667bd740 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mihai-Drosi=20C=C3=A2ju?= <mcaju at cisco.com>
Date: Mon, 13 May 2019 12:08:25 +0300
Subject: [PATCH 1/2] use rm -f in clean target

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 92d7d0d..86a92d7 100644
--- a/Makefile
+++ b/Makefile
@@ -20,4 +20,4 @@ vendorup:
 
 .PHONY: clean
 clean:
-	-rm -r crio-lxc
+	-rm -f crio-lxc

From 22253c752304912783cecf0f5c96dbe68a487e6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mihai-Drosi=20C=C3=A2ju?= <mcaju at cisco.com>
Date: Mon, 13 May 2019 12:40:34 +0300
Subject: [PATCH 2/2] Add dockerfile and static build make target

---
 Makefile          | 10 ++++++++++
 docker/Dockerfile | 11 +++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 docker/Dockerfile

diff --git a/Makefile b/Makefile
index 86a92d7..b3163d9 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,16 @@ CRIO_REPO?=~/packages/cri-o
 crio-lxc: $(GO_SRC)
 	go build -ldflags "-X main.version=$(COMMIT)" -o crio-lxc ./cmd
 
+.PHONY: dokcer-static
+crio-lxc-static: $(GO_SRC)
+	docker build -t build:crio-lxc docker
+	docker run --rm -i -t \
+		-v "$$PWD:/go/src/crio-lxc" \
+		-u $$UID:$$GID \
+		-e HOME=/var/tmp \
+		-w /go/src/crio-lxc \
+		build:crio-lxc make
+
 # make test TEST=basic will run only the basic test.
 .PHONY: check
 check: crio-lxc
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..ff88a4a
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,11 @@
+FROM golang:alpine
+
+RUN \
+	apk update && \
+	apk upgrade && \
+	apk add libcap-dev lxc-dev libseccomp-dev \
+		make git gcc musl-dev && \
+	sed -i 's/^Libs: .*$/Libs: -L${libdir} -static -llxc -lseccomp -lcap -lutil/g' \
+		/usr/lib/pkgconfig/lxc.pc
+
+ENV GO111MODULE on


More information about the lxc-devel mailing list