From fc4f69a1470573f49327e2a3f69348ae5216271d Mon Sep 17 00:00:00 2001 From: Mikhail Sobolev Date: Mon, 25 Mar 2013 23:48:46 +0200 Subject: [PATCH] introduce top-level Makefile to build the docker binary Upstream-commit: 7009d6c6ddc2acc77e7caa227c08ecf29d747298 Component: engine --- components/engine/.gitignore | 1 + components/engine/Makefile | 33 +++++++++++++++++++++++++++++++++ components/engine/README.md | 16 ++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 components/engine/Makefile diff --git a/components/engine/.gitignore b/components/engine/.gitignore index cabd399067..809fa8e268 100644 --- a/components/engine/.gitignore +++ b/components/engine/.gitignore @@ -9,3 +9,4 @@ command-line-arguments.test .flymake* docker.test auth/auth.test +build/ diff --git a/components/engine/Makefile b/components/engine/Makefile new file mode 100644 index 0000000000..82cbb2286d --- /dev/null +++ b/components/engine/Makefile @@ -0,0 +1,33 @@ +DOCKER_PACKAGE := github.com/dotcloud/docker + +BUILD_DIR := $(CURDIR)/build + +GOPATH ?= $(BUILD_DIR) +export GOPATH + +SRC_DIR := $(GOPATH)/src + +DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE) +DOCKER_MAIN := $(DOCKER_DIR)/docker + +DOCKER_BIN := $(CURDIR)/bin/docker + +.PHONY: all clean + +all: $(DOCKER_BIN) + +$(DOCKER_BIN): $(DOCKER_DIR) + @mkdir -p $(dir $@) + (cd $(DOCKER_MAIN); go get; go build -o $@) + +$(DOCKER_DIR): + @mkdir -p $(dir $@) + @ln -sf $(CURDIR)/ $@ + +clean: + @rm -rf $(dir $(DOCKER_BIN)) +ifeq ($(GOPATH), $(BUILD_DIR)) + @rm -rf $(BUILD_DIR) +else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR))) + @rm -f $(DOCKER_DIR) +endif diff --git a/components/engine/README.md b/components/engine/README.md index c955a1dcf2..0ff28ec101 100644 --- a/components/engine/README.md +++ b/components/engine/README.md @@ -53,6 +53,22 @@ Under the hood, Docker is built on the following components: Install instructions ================== +Building from source +-------------------- + +1. Make sure you have a [Go language](http://golang.org) compiler. + + On a Debian/wheezy or Ubuntu 12.10 install the package: + + ```bash + + $ sudo apt-get install golang-go + ``` + +2. Execute ``make`` + +3. Find your binary in ``bin/docker`` + Installing on Ubuntu 12.04 and 12.10 ------------------------------------