add dockerfile/makefile additions for ci
Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
parent
1d63236c27
commit
5b3f41c244
2 changed files with 73 additions and 9 deletions
29
Dockerfile
Normal file
29
Dockerfile
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
build-essential \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
make \
|
||||||
|
--no-install-recommends \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install Go
|
||||||
|
ENV GO_VERSION 1.5.2
|
||||||
|
RUN curl -sSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -v -C /usr/local -xz
|
||||||
|
ENV PATH /go/bin:/usr/local/go/bin:$PATH
|
||||||
|
ENV GOPATH /go:/go/src/github.com/docker/containerd/vendor
|
||||||
|
|
||||||
|
# install golint/vet
|
||||||
|
RUN go get github.com/golang/lint/golint \
|
||||||
|
&& go get golang.org/x/tools/cmd/vet
|
||||||
|
|
||||||
|
COPY . /go/src/github.com/docker/containerd
|
||||||
|
|
||||||
|
# get deps, until they are in vendor
|
||||||
|
# TODO: remomve this when there is a dep tool
|
||||||
|
RUN go get -d -v github.com/docker/containerd/ctr \
|
||||||
|
&& go get -d -v github.com/docker/containerd/containerd
|
||||||
|
|
||||||
|
WORKDIR /go/src/github.com/docker/containerd
|
53
Makefile
53
Makefile
|
@ -1,21 +1,56 @@
|
||||||
|
|
||||||
BUILDTAGS=libcontainer
|
BUILDTAGS=libcontainer
|
||||||
|
|
||||||
all:
|
# if this session isn't interactive, then we don't want to allocate a
|
||||||
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
||||||
|
# so that the user can send e.g. ^C through.
|
||||||
|
INTERACTIVE := $(shell [ -t 0 ] && echo 1 || echo 0)
|
||||||
|
ifeq ($(INTERACTIVE), 1)
|
||||||
|
DOCKER_FLAGS += -t
|
||||||
|
endif
|
||||||
|
|
||||||
|
DOCKER_IMAGE := containerd-dev$(if $(GIT_BRANCH),:$(GIT_BRANCH))
|
||||||
|
DOCKER_RUN := docker run --rm -i $(DOCKER_FLAGS) "$(DOCKER_IMAGE)"
|
||||||
|
|
||||||
|
|
||||||
|
all: client daemon
|
||||||
|
|
||||||
|
bin:
|
||||||
mkdir -p bin/
|
mkdir -p bin/
|
||||||
cd containerd && go build -tags "$(BUILDTAGS)" -o ../bin/containerd
|
|
||||||
|
clean:
|
||||||
|
rm -rf bin
|
||||||
|
|
||||||
|
client: bin
|
||||||
cd ctr && go build -o ../bin/ctr
|
cd ctr && go build -o ../bin/ctr
|
||||||
|
|
||||||
client:
|
daemon: bin
|
||||||
mkdir -p bin/
|
|
||||||
cd ctr && go build -o ../bin/ctr
|
|
||||||
|
|
||||||
daemon:
|
|
||||||
mkdir -p bin/
|
|
||||||
cd containerd && go build -tags "$(BUILDTAGS)" -o ../bin/containerd
|
cd containerd && go build -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||||
|
|
||||||
|
dbuild:
|
||||||
|
@docker build --rm --force-rm -t "$(DOCKER_IMAGE)" .
|
||||||
|
|
||||||
|
dtest: dbuild
|
||||||
|
$(DOCKER_RUN) make test
|
||||||
|
|
||||||
install:
|
install:
|
||||||
cp bin/* /usr/local/bin/
|
cp bin/* /usr/local/bin/
|
||||||
|
|
||||||
protoc:
|
protoc:
|
||||||
protoc -I ./api/grpc/types ./api/grpc/types/api.proto --go_out=plugins=grpc:api/grpc/types
|
protoc -I ./api/grpc/types ./api/grpc/types/api.proto --go_out=plugins=grpc:api/grpc/types
|
||||||
|
|
||||||
|
fmt:
|
||||||
|
@gofmt -s -l . | grep -v vendor | grep -v .pb. | tee /dev/stderr
|
||||||
|
|
||||||
|
lint:
|
||||||
|
@golint ./... | grep -v vendor | grep -v .pb. | tee /dev/stderr
|
||||||
|
|
||||||
|
shell:
|
||||||
|
$(DOCKER_RUN) bash
|
||||||
|
|
||||||
|
test: all validate
|
||||||
|
go test -v $(shell go list ./... | grep -v /vendor)
|
||||||
|
|
||||||
|
validate: fmt lint vet
|
||||||
|
|
||||||
|
vet:
|
||||||
|
go vet $(shell go list ./... | grep -v vendor)
|
||||||
|
|
Loading…
Add table
Reference in a new issue