diff --git a/Makefile b/Makefile index 5ed38f4c9..8977a3baa 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?=dev +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_IMAGE}:latest +endif +endif + get-tools: @echo "+ $@" @go get -u \ diff --git a/pkg/dockerfiles/Dockerfile.build b/dockerfiles/Dockerfile.build similarity index 100% rename from pkg/dockerfiles/Dockerfile.build rename to dockerfiles/Dockerfile.build 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/