From 4fc7ae1228d18ae7386579b4b243a271f0da4dda Mon Sep 17 00:00:00 2001 From: David Chung Date: Mon, 12 Dec 2016 14:55:54 -0800 Subject: [PATCH 1/4] Restore build dockerfile that got clobbered by PR #299 Signed-off-by: David Chung --- pkg/dockerfiles/Dockerfile.build | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 pkg/dockerfiles/Dockerfile.build diff --git a/pkg/dockerfiles/Dockerfile.build b/pkg/dockerfiles/Dockerfile.build deleted file mode 100644 index 5cb570a27..000000000 --- a/pkg/dockerfiles/Dockerfile.build +++ /dev/null @@ -1,23 +0,0 @@ -FROM golang:1.7.1-alpine - -# A container for building InfraKit - -RUN apk add --update git make - -ENV CGO_ENABLED=0 -ENV GOPATH=/go -ENV PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - -# Development tools -RUN go get github.com/rancher/trash \ - github.com/golang/lint/golint \ - github.com/golang/mock/gomock \ - github.com/golang/mock/mockgen - -# The project sources -ADD ./ /go/src/github.com/docker/infrakit -WORKDIR /go/src/github.com/docker/infrakit - -VOLUME [ "/go/src/github.com/docker/infrakit/build" ] - -CMD make build-binaries From 4208a423bd1d5ecf0b5d1f7a3a370bfc350df6a1 Mon Sep 17 00:00:00 2001 From: David Chung Date: Mon, 12 Dec 2016 15:08:14 -0800 Subject: [PATCH 2/4] Added misplaced dockerfile Signed-off-by: David Chung --- dockerfiles/Dockerfile.build | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 dockerfiles/Dockerfile.build diff --git a/dockerfiles/Dockerfile.build b/dockerfiles/Dockerfile.build new file mode 100644 index 000000000..5cb570a27 --- /dev/null +++ b/dockerfiles/Dockerfile.build @@ -0,0 +1,23 @@ +FROM golang:1.7.1-alpine + +# A container for building InfraKit + +RUN apk add --update git make + +ENV CGO_ENABLED=0 +ENV GOPATH=/go +ENV PATH=/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +# Development tools +RUN go get github.com/rancher/trash \ + github.com/golang/lint/golint \ + github.com/golang/mock/gomock \ + github.com/golang/mock/mockgen + +# The project sources +ADD ./ /go/src/github.com/docker/infrakit +WORKDIR /go/src/github.com/docker/infrakit + +VOLUME [ "/go/src/github.com/docker/infrakit/build" ] + +CMD make build-binaries From 0df60ab0fc119b5e10b52924b1ff856906643c28 Mon Sep 17 00:00:00 2001 From: David Chung Date: Mon, 12 Dec 2016 15:28:56 -0800 Subject: [PATCH 3/4] build targets for building docker container images Signed-off-by: David Chung --- Makefile | 19 ++++++++++++++++++- dockerfiles/Dockerfile.bundle | 10 ++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 dockerfiles/Dockerfile.bundle diff --git a/Makefile b/Makefile index 5ed38f4c9..11e3ffc16 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,6 @@ PKGS := $(shell echo $(PKGS_AND_MOCKS) | tr ' ' '\n' | grep -v /mock$) # Current working environment. Set these explicitly if you want to cross-compile # in the build container (see the build-in-container target): - GOOS?=$(shell go env GOOS) GOARCH?=$(shell go env GOARCH) build-in-container: clean @@ -37,6 +36,24 @@ build-in-container: clean -v ${CURDIR}/build:/go/src/github.com/docker/infrakit/build \ infrakit-build +# For packaging as Docker container images. Set the environment variables DOCKER_PUSH, DOCKER_TAG_LATEST +# if also push to remote repo. You must have access to the remote repo. +DOCKER_IMAGE?=infrakit/bundle +DOCKER_TAG?=v0.1.0 +build-docker: + @echo "+ $@" + GOOS=linux GOARCH=amd64 make build-in-container + @docker build --no-cache --pull \ + -t ${DOCKER_IMAGE}:${DOCKER_TAG} \ + -t ${DOCKER_IMAGE}:latest \ + -f ${CURDIR}/dockerfiles/Dockerfile.bundle . +ifeq (${DOCKER_PUSH},true) + @docker push ${DOCKER_IMAGE}:${DOCKER_TAG} +ifeq (${DOCKER_TAG_LATEST},true) + @docker push ${DOCKER_REPO}:latest +endif +endif + get-tools: @echo "+ $@" @go get -u \ diff --git a/dockerfiles/Dockerfile.bundle b/dockerfiles/Dockerfile.bundle new file mode 100644 index 000000000..8a03a789c --- /dev/null +++ b/dockerfiles/Dockerfile.bundle @@ -0,0 +1,10 @@ +FROM alpine:3.4 + +# InfraKit bundle: a simple container for all of the default InfraKit executables + +MAINTAINER David Chung + +RUN apk add --update ca-certificates && rm -Rf /tmp/* /var/lib/cache/apk/* +RUN mkdir /lib64 && ln -s /lib/libc.musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2 + +ADD build/* /usr/local/bin/ From 480db54c11681410ee9f73ce7e284f2ef8c5cfa1 Mon Sep 17 00:00:00 2001 From: David Chung Date: Mon, 12 Dec 2016 15:40:11 -0800 Subject: [PATCH 4/4] Fix errors in Makefile Signed-off-by: David Chung --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 11e3ffc16..8977a3baa 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ build-in-container: clean # For packaging as Docker container images. Set the environment variables DOCKER_PUSH, DOCKER_TAG_LATEST # if also push to remote repo. You must have access to the remote repo. DOCKER_IMAGE?=infrakit/bundle -DOCKER_TAG?=v0.1.0 +DOCKER_TAG?=dev build-docker: @echo "+ $@" GOOS=linux GOARCH=amd64 make build-in-container @@ -50,7 +50,7 @@ build-docker: ifeq (${DOCKER_PUSH},true) @docker push ${DOCKER_IMAGE}:${DOCKER_TAG} ifeq (${DOCKER_TAG_LATEST},true) - @docker push ${DOCKER_REPO}:latest + @docker push ${DOCKER_IMAGE}:latest endif endif