-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
28 lines (22 loc) · 963 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
CGO_ENABLED := 1
GO_LDFLAGS_STATIC=-ldflags "-w -extldflags -static"
ctrwrap: build
rootfs.tar.gz: rootfs.tar
gzip -f -k rootfs.tar
rootfs.tar:
$(eval CONTAINER_ID := $(shell docker create quay.io/sysdig/secure-inline-scan:2))
docker export $(CONTAINER_ID) -o rootfs.tar
docker rm $(CONTAINER_ID)
mkdir rootfs
tar -C rootfs -xvf rootfs.tar
chmod -R u+rw rootfs/*
rm rootfs.tar
tar -C rootfs -cvf rootfs.tar .
rm -f -r rootfs
build-static: rootfs.tar.gz main.go
docker run --rm -v $(shell pwd):/go/src/app -w /go/src/app golang:1.17-stretch go build ${GO_LDFLAGS_STATIC} -o ctrwrap main.go
build: rootfs.tar.gz main.go
docker run --rm -v $(shell pwd):/go/src/app -w /go/src/app golang:1.17-stretch go build -o ctrwrap main.go
# docker run --rm -v $(shell pwd):/go/src/app -w /go/src/app golang:1.17-stretch sh -c "objdump -T ctrwrap | grep GLIBC_"
build-local: main.go
CGO_ENABLED=$(CGO_ENABLED) go build ${GO_LDFLAGS_STATIC} -o ctrwrap main.go