mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-25 15:54:43 +00:00
Build push image to the right place and adjust makefile to use script (#35)
* build push docker image * Update build-push-featurebranch.sh
This commit is contained in:
parent
3f0ce35de0
commit
c3d0941d9c
5
Makefile
5
Makefile
@ -17,8 +17,6 @@ help: ## This help.
|
||||
|
||||
# Variables and lists
|
||||
TS_SUFFIX="$(shell date '+%s')"
|
||||
DOCKER_IMG="up9inc/mizu"
|
||||
DOCKER_TAG="latest"
|
||||
|
||||
ui: ## build UI
|
||||
@(cd ui; npm i ; npm run build; )
|
||||
@ -38,8 +36,7 @@ tap: ## build tap binary
|
||||
|
||||
docker: ## build Docker image
|
||||
@(echo "building docker image" )
|
||||
docker build -t ${DOCKER_IMG}:${DOCKER_TAG} .
|
||||
docker images ${DOCKER_IMG}
|
||||
./build-push-featurebranch.sh
|
||||
|
||||
publish: ## build and publish Mizu docker image & CLI
|
||||
@echo "publishing Docker image .. "
|
||||
|
20
build-push-featurebranch.sh
Executable file
20
build-push-featurebranch.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SERVER_NAME=mizu
|
||||
GCP_PROJECT=up9-docker-hub
|
||||
REPOSITORY=gcr.io/$GCP_PROJECT
|
||||
GIT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2 | tr '[:upper:]' '[:lower:]')
|
||||
DOCKER_TAGGED_BUILD=$REPOSITORY/$SERVER_NAME/$GIT_BRANCH:latest
|
||||
|
||||
if [ "$GIT_BRANCH" = 'develop' -o "$GIT_BRANCH" = 'master' -o "$GIT_BRANCH" = 'main' ]
|
||||
then
|
||||
echo "Pushing to $GIT_BRANCH is allowed only via CI"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "building $DOCKER_TAGGED_BUILD"
|
||||
docker build -t "$DOCKER_TAGGED_BUILD" .
|
||||
|
||||
echo pushing to "$REPOSITORY"
|
||||
docker push "$DOCKER_TAGGED_BUILD"
|
Loading…
Reference in New Issue
Block a user