diff --git a/.gitignore b/.gitignore index cabd399067..809fa8e268 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ command-line-arguments.test .flymake* docker.test auth/auth.test +build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..82cbb2286d --- /dev/null +++ b/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/README.md b/README.md index c955a1dcf2..0ff28ec101 100644 --- a/README.md +++ b/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 ------------------------------------