diff --git a/test/virtsock/Dockerfile b/test/virtsock/Dockerfile new file mode 100644 index 000000000..6ba3cf281 --- /dev/null +++ b/test/virtsock/Dockerfile @@ -0,0 +1,14 @@ +FROM linuxkit/go-compile:4513068d9a7e919e4ec42e2d7ee879ff5b95b7f5@sha256:bdfadbe3e4ec699ca45b67453662321ec270f2d1a1dbdbf09625776d3ebd68c5 AS virtsock-build + +ENV VIRTSOCK_COMMIT=6b4dec728264e07c41e108caebd6bc2b72559a5f +RUN mkdir -p $GOPATH/src/github.com/rneugeba && \ + cd $GOPATH/src/github.com/rneugeba && \ + git clone https://github.com/rneugeba/virtsock.git +WORKDIR $GOPATH/src/github.com/rneugeba/virtsock +RUN git checkout $VIRTSOCK_COMMIT +RUN make build/virtsock_stress.linux +RUN cp -a build/virtsock_stress.linux /virtsock_stress + +FROM linuxkit/tini:6714d66b82b5397f497b2aa05764096ed1ffe7d7@sha256:ba594b96af6195737ce2df702196d7adea2cafde554e18940ee14ad575d27f3b +COPY --from=virtsock-build virtsock_stress bin/virtsock_stress +CMD ["/bin/tini", "/bin/virtsock_stress", "-s", "-v", "1"] diff --git a/test/virtsock/Makefile b/test/virtsock/Makefile index ea29d83cb..a88497657 100644 --- a/test/virtsock/Makefile +++ b/test/virtsock/Makefile @@ -1,46 +1,26 @@ -.PHONY: tag push clean container -all: push - -# Build the virtsock stress server -VIRTSOCK_BINARY=bin/virtsock_stress -DEPS=Dockerfile.build Makefile -virtsock.tag: $(DEPS) - BUILD=$$(docker build -f $< -q .) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && echo "$$BUILD" > $@ - -$(VIRTSOCK_BINARY): virtsock.tag - mkdir -p $(dir $@) - docker run --rm --net=none --log-driver=none $(shell cat virtsock.tag) > $@ - chmod ugo+x $@ - -TINI_IMAGE=linuxkit/tini:da0e068f8b537b81f817439a52f63e8f6d91cca3@sha256:bdca5e6703c9553d890c79a4a094e2f05df87f09f6bd5bef26c06d6cba56c112 -TINI_BINARY=bin/tini - -$(TINI_BINARY): - mkdir -p $(dir $@) - docker run --rm --net=none $(TINI_IMAGE) tar cf - $@ | tar xf - - -SHASUM=alpine:3.5 +.PHONY: tag push IMAGE=test-virtsock -container: Dockerfile.pkg $(DEPS) $(VIRTSOCK_BINARY) $(TINI_BINARY) - tar cf - $^ | docker build --no-cache -t $(IMAGE):build -f $< - -hash: Dockerfile.pkg $(DEPS) +default: push + +DEPS=Dockerfile Makefile +SHASUM=alpine:3.5 +hash: $(DEPS) find $^ -type f | xargs cat | DOCKER_CONTENT_TRUST=1 docker run --rm -i $(SHASUM) sha1sum | sed 's/ .*//' > $@ -push: hash container +tag: hash docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - (docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) && \ - docker push linuxkit/$(IMAGE):$(shell cat hash)) - docker rmi $(IMAGE):build - rm -f hash + (docker build --no-cache -t $(IMAGE):build . && \ + docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash)) + docker rmi $(IMAGE):build || true -tag: hash container +push: tag docker pull linuxkit/$(IMAGE):$(shell cat hash) || \ - docker tag $(IMAGE):build linuxkit/$(IMAGE):$(shell cat hash) - docker rmi $(IMAGE):build + docker push linuxkit/$(IMAGE):$(shell cat hash) rm -f hash clean: - rm -rf $(VIRTSOCK_BINARY) $(TINI_BINARY) virtsock.tag hash + rm -rf hash + docker rmi $(IMAGE):build || true .DELETE_ON_ERROR: diff --git a/test/virtsock/test-virtsock-server.yml b/test/virtsock/test-virtsock-server.yml index 481392b65..5872e57c7 100644 --- a/test/virtsock/test-virtsock-server.yml +++ b/test/virtsock/test-virtsock-server.yml @@ -38,8 +38,11 @@ services: net: host oomScoreAdj: -800 - name: virtsock-server - image: "linuxkit/test-virtsock:cd2135acdc225f3bd0503678bb50bbd3e0b194b2" + image: "linuxkit/test-virtsock:89133a5081b44dcda66e57502bcbc783e0a654be" readonly: true +trust: + image: + - linuxkit/kernel outputs: - format: kernel+initrd - format: iso-bios