Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

feat: add Dockerfile and Makefile #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM instrumentisto/dep:0.4.1 AS builder
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better use official golang Go images. That way someone reading this dockerfile doesn't have to go figure out what instrumentisto images do. The build process is simple enough to be able to use a vanilla approach.

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/

28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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}'