diff --git a/.gitignore b/.gitignore index be48820bbe..caf5e872eb 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ auth/auth.test .DS_Store docs/_build docs/_static -docs/_templates \ No newline at end of file +docs/_templates +.gopath/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..e716762d31 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +DOCKER_PACKAGE := github.com/dotcloud/docker + +BUILD_DIR := $(CURDIR)/.gopath + +GOPATH ?= $(BUILD_DIR) +export GOPATH + +GO_OPTIONS ?= +ifeq ($(VERBOSE), 1) +GO_OPTIONS += -v +endif + +SRC_DIR := $(GOPATH)/src + +DOCKER_DIR := $(SRC_DIR)/$(DOCKER_PACKAGE) +DOCKER_MAIN := $(DOCKER_DIR)/docker + +DOCKER_BIN_RELATIVE := bin/docker +DOCKER_BIN := $(CURDIR)/$(DOCKER_BIN_RELATIVE) + +.PHONY: all clean test + +all: $(DOCKER_BIN) + +$(DOCKER_BIN): $(DOCKER_DIR) + @mkdir -p $(dir $@) + @(cd $(DOCKER_MAIN); go get $(GO_OPTIONS); go build $(GO_OPTIONS) -o $@) + @echo $(DOCKER_BIN_RELATIVE) is created. + +$(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 + +test: all + @(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS)) diff --git a/README.md b/README.md index 4fc7778456..9cf3daf6a2 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,30 @@ 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`` + + This command will install all necessary dependencies and build the + executable that you can find in ``bin/docker`` + +3. Should you like to see what's happening, run ``make`` with ``VERBOSE=1`` parameter: + + ```bash + + $ make VERBOSE=1 + ``` + Installing on Ubuntu 12.04 and 12.10 ------------------------------------