Skip to content

Commit

Permalink
Add kind to build image
Browse files Browse the repository at this point in the history
  • Loading branch information
tdmanv committed Aug 15, 2019
1 parent 0c9a958 commit f6ca53a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
cache:
directories:
- .go/pkg/mod/cache
- .go/cache

script:
- make docs
Expand Down
43 changes: 21 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ IMAGE_NAME := $(BIN)

IMAGE := $(REGISTRY)/$(IMAGE_NAME)

BUILD_IMAGE ?= kanisterio/build:v0.0.2
BUILD_IMAGE ?= kanisterio/build:v0.0.3
DOCS_BUILD_IMAGE ?= kanisterio/docker-sphinx

DOCS_RELEASE_BUCKET ?= s3://docs.kanister.io
Expand Down Expand Up @@ -161,9 +161,7 @@ test: build-dirs
@$(MAKE) run CMD='-c "./build/test.sh $(SRC_DIRS)"'

codegen:
@$(MAKE) run CMD='-c " \
./build/codegen.sh \
"'
@$(MAKE) run CMD='-c "./build/codegen.sh"'

DOCS_CMD = "cd docs && make clean && \
doc8 --max-line-length 90 --ignore D000 . && \
Expand All @@ -173,12 +171,12 @@ DOCS_CMD = "cd docs && make clean && \
docs:
ifeq ($(DOCKER_BUILD),"true")
@echo "running DOCS_CMD in the containerized build environment"
@docker run \
--entrypoint '' \
--rm \
-v "$(PWD):/repo" \
-w /repo \
$(DOCS_BUILD_IMAGE) \
@docker run \
--entrypoint '' \
--rm \
-v "$(PWD):/repo" \
-w /repo \
$(DOCS_BUILD_IMAGE) \
/bin/bash -c $(DOCS_CMD)
else
@/bin/bash -c $(DOCS_CMD)
Expand All @@ -191,18 +189,19 @@ build-dirs:
run: build-dirs
ifeq ($(DOCKER_BUILD),"true")
@echo "running CMD in the containerized build environment"
@docker run \
--rm \
--net host \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-v "${HOME}/.kube:/root/.kube" \
-v "$(PWD)/.go/pkg:/go/pkg" \
-v "$(PWD):/go/src/$(PKG)" \
-v "$(PWD)/bin/$(ARCH)/$$(go env GOOS)_$(ARCH):/go/bin" \
-v "$(PWD)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static" \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/$(PKG) \
$(BUILD_IMAGE) \
@docker run \
--rm \
--net host \
-e GITHUB_TOKEN=$(GITHUB_TOKEN) \
-v "${HOME}/.kube:/root/.kube" \
-v "$(PWD)/.go/pkg:/go/pkg" \
-v "$(PWD)/.go/cache:/go/.cache" \
-v "$(PWD):/go/src/$(PKG)" \
-v "$(PWD)/bin/$(ARCH)/$$(go env GOOS)_$(ARCH):/go/bin" \
-v "$(PWD)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/$(PKG) \
$(BUILD_IMAGE) \
/bin/sh $(CMD)
else
@/bin/bash $(CMD)
Expand Down
2 changes: 1 addition & 1 deletion build/release_kanctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ then
echo "You can generate a token here: https://github.com/settings/tokens/new"
exit 1
fi
goreleaser --rm-dist
goreleaser release --parallelism=1 --rm-dist
8 changes: 6 additions & 2 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ FROM golang:1.12-alpine3.10
MAINTAINER Tom Manville <tom@kasten.io>

RUN apk add --update --no-cache ca-certificates bash git docker jq \
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*
&& update-ca-certificates \
&& rm -rf /var/cache/apk/*

COPY --from=bitnami/kubectl:1.13.4 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/

COPY --from=goreleaser/goreleaser:v0.115.0 /bin/goreleaser /usr/local/bin/

RUN wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.4.0/kind-darwin-amd64 \
&& chmod +x /usr/local/bin/kind

ENV CGO_ENABLED=0 \
GO111MODULE="on" \
GOROOT="/usr/local/go" \
GOCACHE=/go/.cache/go-build \
GO_EXTLINK_ENABLED=0 \
PATH="/usr/local/go/bin:${PATH}"

0 comments on commit f6ca53a

Please sign in to comment.