From 8f1fca3e669e34f9db1b960f798614f187ab4b91 Mon Sep 17 00:00:00 2001 From: Flavio Crisciani Date: Tue, 19 Jun 2018 17:19:16 -0700 Subject: [PATCH] Multistage for build Signed-off-by: Flavio Crisciani --- libnetwork/.circleci/config.yml | 7 ++++++- libnetwork/{Dockerfile.ci => Dockerfile} | 4 +++- libnetwork/Dockerfile.build | 11 ----------- libnetwork/Makefile | 2 +- libnetwork/osl/sandbox_linux_test.go | 3 +-- libnetwork/osl/sandbox_test.go | 1 - 6 files changed, 11 insertions(+), 17 deletions(-) rename libnetwork/{Dockerfile.ci => Dockerfile} (90%) delete mode 100644 libnetwork/Dockerfile.build diff --git a/libnetwork/.circleci/config.yml b/libnetwork/.circleci/config.yml index 77745d736c..e5c51f8e6d 100644 --- a/libnetwork/.circleci/config.yml +++ b/libnetwork/.circleci/config.yml @@ -5,7 +5,7 @@ defaults: &defaults docker: - image: 'circleci/golang:1.10' environment: - dockerbuildargs: -f Dockerfile.ci . + dockerbuildargs: . dockerargs: --privileged -e CIRCLECI jobs: @@ -14,6 +14,7 @@ jobs: steps: - checkout - setup_remote_docker: + version: 18.05.0-ce reusable: true exclusive: false - run: make builder @@ -23,6 +24,7 @@ jobs: steps: - checkout - setup_remote_docker: + version: 18.05.0-ce reusable: true exclusive: false - run: make build @@ -32,6 +34,7 @@ jobs: steps: - checkout - setup_remote_docker: + version: 18.05.0-ce reusable: true exclusive: false - run: make check @@ -41,6 +44,7 @@ jobs: steps: - checkout - setup_remote_docker: + version: 18.05.0-ce reusable: true exclusive: false - run: make cross @@ -50,6 +54,7 @@ jobs: steps: - checkout - setup_remote_docker: + version: 18.05.0-ce reusable: true exclusive: false - run: make unit-tests diff --git a/libnetwork/Dockerfile.ci b/libnetwork/Dockerfile similarity index 90% rename from libnetwork/Dockerfile.ci rename to libnetwork/Dockerfile index 3ca5d953d0..6ecb91046d 100644 --- a/libnetwork/Dockerfile.ci +++ b/libnetwork/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.10 +FROM golang:1.10.2 as dev RUN apt-get update && apt-get -y install iptables RUN go get github.com/golang/lint/golint \ @@ -10,4 +10,6 @@ RUN go get github.com/golang/lint/golint \ WORKDIR /go/src/github.com/docker/libnetwork +FROM dev + COPY . . diff --git a/libnetwork/Dockerfile.build b/libnetwork/Dockerfile.build deleted file mode 100644 index 77433a9792..0000000000 --- a/libnetwork/Dockerfile.build +++ /dev/null @@ -1,11 +0,0 @@ -FROM golang:1.10.2 -RUN apt-get update && apt-get -y install iptables - -RUN go get github.com/golang/lint/golint \ - golang.org/x/tools/cmd/cover \ - github.com/mattn/goveralls \ - github.com/gordonklaus/ineffassign \ - github.com/client9/misspell/cmd/misspell \ - honnef.co/go/tools/cmd/gosimple - -WORKDIR /go/src/github.com/docker/libnetwork diff --git a/libnetwork/Makefile b/libnetwork/Makefile index aad6d51d23..c35b55a6c3 100644 --- a/libnetwork/Makefile +++ b/libnetwork/Makefile @@ -1,6 +1,6 @@ .PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-local check-code check-format unit-tests SHELL=/bin/bash -dockerbuildargs ?= - < Dockerfile.build +dockerbuildargs ?= --target dev - < Dockerfile dockerargs ?= --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork build_image=libnetworkbuild container_env = -e "INSIDECONTAINER=-incontainer=true" diff --git a/libnetwork/osl/sandbox_linux_test.go b/libnetwork/osl/sandbox_linux_test.go index dd4284d1fe..a5dd384d0a 100644 --- a/libnetwork/osl/sandbox_linux_test.go +++ b/libnetwork/osl/sandbox_linux_test.go @@ -76,7 +76,7 @@ func newInfo(hnd *netlink.Handle, t *testing.T) (Sandbox, error) { intf1.address = addr intf1.address.IP = ip4 - ip6, addrv6, err := net.ParseCIDR("2001:DB8::ABCD/48") + ip6, addrv6, err := net.ParseCIDR("fe80::2/64") if err != nil { return nil, err } @@ -111,7 +111,6 @@ func newInfo(hnd *netlink.Handle, t *testing.T) (Sandbox, error) { info := &networkNamespace{iFaces: []*nwIface{intf1, intf2, intf3}} info.gw = net.ParseIP("192.168.1.1") - // sinfo.GatewayIPv6 = net.ParseIP("2001:DB8::1") info.gwv6 = net.ParseIP("fe80::1") return info, nil diff --git a/libnetwork/osl/sandbox_test.go b/libnetwork/osl/sandbox_test.go index d3bd1aceb8..2f89fc3a10 100644 --- a/libnetwork/osl/sandbox_test.go +++ b/libnetwork/osl/sandbox_test.go @@ -29,7 +29,6 @@ func TestSandboxCreate(t *testing.T) { if err != nil { t.Fatalf("Failed to create a new sandbox: %v", err) } - runtime.LockOSThread() if s.Key() != key { t.Fatalf("s.Key() returned %s. Expected %s", s.Key(), key)