2015-12-18 19:18:41 +08:00
|
|
|
RUNC_IMAGE=runc_dev
|
2015-06-27 04:06:17 +08:00
|
|
|
RUNC_TEST_IMAGE=runc_test
|
|
|
|
PROJECT=github.com/opencontainers/runc
|
2015-07-01 04:05:13 +08:00
|
|
|
TEST_DOCKERFILE=script/test_Dockerfile
|
2015-08-22 06:25:26 +08:00
|
|
|
BUILDTAGS=seccomp
|
2015-12-18 19:18:41 +08:00
|
|
|
RUNC_BUILD_PATH=/go/src/github.com/opencontainers/runc/runc
|
|
|
|
RUNC_INSTANCE=runc_dev
|
2016-03-12 05:49:45 +08:00
|
|
|
COMMIT=$(shell git rev-parse HEAD 2> /dev/null || true)
|
2016-03-01 15:45:18 +08:00
|
|
|
RUNC_LINK=$(CURDIR)/Godeps/_workspace/src/github.com/opencontainers/runc
|
2016-04-09 22:05:33 +08:00
|
|
|
export GOPATH:=$(CURDIR)/Godeps/_workspace
|
2015-06-27 04:06:17 +08:00
|
|
|
|
2015-12-18 19:18:41 +08:00
|
|
|
.PHONY=dbuild
|
|
|
|
|
2016-04-09 21:54:31 +08:00
|
|
|
all: $(RUNC_LINK)
|
2016-04-09 21:57:26 +08:00
|
|
|
go build -i -ldflags "-X main.gitCommit=${COMMIT}" -tags "$(BUILDTAGS)" -o runc .
|
2015-06-27 04:06:17 +08:00
|
|
|
|
2016-04-09 21:54:31 +08:00
|
|
|
static: $(RUNC_LINK)
|
2016-04-09 21:57:26 +08:00
|
|
|
CGO_ENABLED=1 go build -i -tags "$(BUILDTAGS) cgo static_build" -ldflags "-w -extldflags -static -X main.gitCommit=${COMMIT}" -o runc .
|
2015-11-15 08:33:52 +08:00
|
|
|
|
2016-04-09 21:54:31 +08:00
|
|
|
$(RUNC_LINK):
|
|
|
|
ln -sfn $(CURDIR) $(RUNC_LINK)
|
|
|
|
|
2016-04-08 00:36:08 +08:00
|
|
|
lint:
|
2015-06-27 04:06:17 +08:00
|
|
|
go vet ./...
|
|
|
|
go fmt ./...
|
|
|
|
|
|
|
|
runctestimage:
|
|
|
|
docker build -t $(RUNC_TEST_IMAGE) -f $(TEST_DOCKERFILE) .
|
|
|
|
|
|
|
|
test: runctestimage
|
2016-02-12 02:42:28 +08:00
|
|
|
docker run -e TESTFLAGS -ti --privileged --rm -v $(CURDIR):/go/src/$(PROJECT) $(RUNC_TEST_IMAGE) make localtest
|
|
|
|
tests/sniffTest
|
2015-06-27 04:06:17 +08:00
|
|
|
|
2016-02-12 02:42:28 +08:00
|
|
|
localtest: all
|
2015-08-22 06:25:26 +08:00
|
|
|
go test -tags "$(BUILDTAGS)" ${TESTFLAGS} -v ./...
|
|
|
|
|
2016-03-28 20:25:22 +08:00
|
|
|
dbuild: runctestimage
|
2015-12-18 19:18:41 +08:00
|
|
|
docker build -t $(RUNC_IMAGE) .
|
|
|
|
docker create --name=$(RUNC_INSTANCE) $(RUNC_IMAGE)
|
|
|
|
docker cp $(RUNC_INSTANCE):$(RUNC_BUILD_PATH) .
|
|
|
|
docker rm $(RUNC_INSTANCE)
|
2015-06-22 10:31:12 +08:00
|
|
|
|
2015-06-30 04:33:15 +08:00
|
|
|
install:
|
2016-03-28 20:25:22 +08:00
|
|
|
install -D -m0755 runc /usr/local/sbin/runc
|
2015-06-22 10:31:12 +08:00
|
|
|
|
2016-03-14 09:59:36 +08:00
|
|
|
uninstall:
|
2016-03-28 20:25:22 +08:00
|
|
|
rm -f /usr/local/sbin/runc
|
2016-03-14 09:59:36 +08:00
|
|
|
|
2015-06-22 10:31:12 +08:00
|
|
|
clean:
|
2016-03-01 15:45:18 +08:00
|
|
|
rm -f runc
|
|
|
|
rm -f $(RUNC_LINK)
|
2016-04-09 21:57:26 +08:00
|
|
|
rm -rf $(GOPATH)/pkg
|
2015-07-01 03:51:09 +08:00
|
|
|
|
2016-04-08 00:36:08 +08:00
|
|
|
validate:
|
2015-07-01 03:51:09 +08:00
|
|
|
script/validate-gofmt
|
|
|
|
go vet ./...
|
|
|
|
|
|
|
|
ci: validate localtest
|