diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b05c4eb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,51 @@ +tag_annotation +coverage.out +ipfs-cluster-service/ipfs-cluster-service +ipfs-cluster-ctl/ipfs-cluster-ctl +deptools +sharness/lib/sharness +sharness/test-results +sharness/trash* + +raftFolderFromTest* +peerstore + +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test +test/sharness/test-results +test/sharness/trash* +test/sharness/lib/sharness +test/sharness/.test_config +test/sharness/.test_ipfs + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +.gx/ +.snapcraft/ +ipfs-cluster/ + +Dockerfile* +Jenkinsfile* +.git/ +.idea/ +*.iml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9aa70ff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM instrumentisto/dep:0.4.1 AS builder +ENV GOPATH /go +ENV SRC_PATH $GOPATH/src/github.com/ipfs/kubernetes-ipfs +WORKDIR $SRC_PATH + +COPY . $SRC_PATH +RUN \ + dep init -v \ + && dep ensure -v \ + && go build + +# === + +FROM busybox:1-glibc +ENV GOPATH /go + +COPY --from=builder \ + /go/src/github.com/ipfs/kubernetes-ipfs /code/ + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ee302ae --- /dev/null +++ b/Makefile @@ -0,0 +1,28 @@ +NAME := kubernetes-ipfs +REGISTRY := docker.io/controlplane +GIT_TAG ?= $(shell bash -c 'TAG=$$(git tag | tail -n1); echo "$${TAG:-none}"') + +CONTAINER_TAG ?= $(GIT_TAG) +CONTAINER_NAME := $(REGISTRY)/$(NAME):$(CONTAINER_TAG) +CONTAINER_NAME_LATEST := $(REGISTRY)/$(NAME):latest + +all: help + +docker-build: ## builds the test docker image + @echo "+ $@" + docker build -f Dockerfile --tag "$(CONTAINER_NAME)" . + docker tag "$(CONTAINER_NAME)" "$(CONTAINER_NAME_LATEST)" + @echo "Successfully tagged $(CONTAINER_NAME) as $(CONTAINER_NAME_LATEST)" + +docker-push: ## pushes the docker image + @echo "+ $@" + docker push "$(CONTAINER_NAME)" + docker push "$(CONTAINER_NAME_LATEST)" + +help: ## parse jobs and descriptions from this Makefile + @grep -E '^[ a-zA-Z0-9_-]+:([^=]|$$)' $(MAKEFILE_LIST) \ + | grep -Ev '^help\b[[:space:]]*:' \ + | sort \ + | awk 'BEGIN {FS = ":.*?##"}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + +.PHONY: all docker-build docker-push help