-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from infracloudio/infracloudio/add-Makefile
Issue #46: Removed @botkube help commands. Added Makefile to add support for git tags and docker build with versioning
- Loading branch information
Showing
6 changed files
with
59 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
release=1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
IMAGE_REPO=infracloud/botkube | ||
TAG=$(shell cut -d'=' -f2- .release) | ||
|
||
.DEFAULT_GOAL := build | ||
.PHONY: release git-tag check-git-status build pre-build tag-image publish | ||
|
||
#Docker Tasks | ||
#Make a release | ||
release: check-git-status build tag-image publish git-tag | ||
@echo "Successfully released version $(TAG)" | ||
|
||
#Create a git tag | ||
git-tag: | ||
@echo "Creating a git tag" | ||
@git add . | ||
@git commit -m "Bumped to version $(TAG)" ; | ||
@git tag $(TAG) ; | ||
@git push --tags origin master; | ||
@echo 'Git tag pushed successfully' ; | ||
|
||
#Check git status | ||
check-git-status: | ||
@echo "Checking git status" | ||
@if [ -n "$(shell git tag | grep $(TAG))" ] ; then echo 'Tag already exists' && exit 1 ; fi | ||
@if [ -z "$(shell git remote -v)" ] ; then echo 'No remote to push tags to' && exit 1 ; fi | ||
@if [ -z "$(shell git config user.email)" ] ; then echo 'Unable to detect git credentials' && exit 1 ; fi | ||
|
||
#Build the image | ||
build: pre-build | ||
@echo "Building docker image" | ||
@docker build --build-arg GOOS_VAL=$(shell go env GOOS) --build-arg GOARCH_VAL=$(shell go env GOARCH) -t $(IMAGE_REPO) -f build/Dockerfile --no-cache . | ||
@echo "Docker image build successfully" | ||
|
||
#Pre-build checks | ||
pre-build: | ||
@echo "Checking system information" | ||
@if [ -z "$(shell go env GOOS)" ] || [ -z "$(shell go env GOARCH)" ] ; then echo 'Could not determine the system architecture.' && exit 1 ; fi | ||
|
||
|
||
#Tag images | ||
tag-image: | ||
@echo 'Tagging image' | ||
@docker tag $(IMAGE_REPO) $(IMAGE_REPO):$(TAG) | ||
@docker tag $(IMAGE_REPO) $(IMAGE_REPO):latest | ||
|
||
#Docker push image | ||
publish: | ||
@echo "Pushing docker image to repository" | ||
@docker login | ||
@docker push $(IMAGE_REPO):$(TAG) | ||
@docker push $(IMAGE_REPO):latest |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters