mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-01-14 20:08:14 +00:00
Go code is really fast to compile so we do not really need to use the cache features of `docker build`. So make a compile container instead. This can also output a build context and Dockerfile if you want to do a build. For reference, an uncached `docker build` of our Go code takes about 7s, a cached one 1.2s, and this takes 1.7s, so the best case is a little worse, but we save a lot of images, and the worst case is better. This is mainly designed to make the nested builds for containerd containers simpler too. Will add a variant for the C code as well. Also add `-static` to the flags so we always make static executables, which was omitted previously. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
23 lines
554 B
Makefile
23 lines
554 B
Makefile
# Tag: 470f68ec32e016484fb8e0bcc2f06cd3f201ea68
|
|
GO_COMPILE=mobylinux/go-compile@sha256:b723c0e95a6293300392e57d6ab52574f9217e2410b390a24cbfc4f9070edb6b
|
|
|
|
all: usr/bin/slirp-proxy sbin/proxy-vsockd
|
|
|
|
DEPS=Dockerfile $(wildcard *.go libproxy/*.go)
|
|
|
|
proxy: $(DEPS) ../vendor/manifest
|
|
tar cf - $(DEPS) -C .. vendor | docker run --rm --net=none --log-driver=none -i $(GO_COMPILE) -o $@ | tar xf -
|
|
|
|
usr/bin/slirp-proxy: proxy
|
|
mkdir -p usr/bin
|
|
cp proxy $@
|
|
|
|
sbin/proxy-vsockd: proxy
|
|
mkdir -p sbin
|
|
cp proxy $@
|
|
|
|
clean:
|
|
rm -rf proxy sbin usr
|
|
|
|
.DELETE_ON_ERROR:
|