2017-03-23 05:36:36 +01:00
# Makefile for Harbor project
2017-06-13 11:13:24 +02:00
#
2017-03-23 05:36:36 +01:00
# Targets:
#
2017-06-13 11:13:24 +02:00
# all: prepare env, compile binarys, build images and install images
2017-03-23 05:36:36 +01:00
# prepare: prepare env
# compile: compile adminserver, ui and jobservice code
#
# compile_golangimage:
# compile from golang image
# for example: make compile_golangimage -e GOBUILDIMAGE= \
# golang:1.7.3
# compile_adminserver, compile_ui, compile_jobservice: compile specific binary
#
2017-06-23 04:54:27 +02:00
# build: build Harbor docker images (default: build_photon)
2017-03-23 05:36:36 +01:00
# for example: make build -e BASEIMAGE=photon
# build_photon: build Harbor docker images from photon baseimage
2017-06-13 11:13:24 +02:00
#
2017-06-23 04:54:27 +02:00
# build_postgresql: build postgresql images basaed on photon os
# make build -e BASEIMAGE=postgresql
2017-06-13 11:13:24 +02:00
# install: include compile binarys, build images, prepare specific \
2017-03-23 05:36:36 +01:00
# version composefile and startup Harbor instance
#
2017-06-13 11:13:24 +02:00
# start: startup Harbor instance
2017-03-23 05:36:36 +01:00
#
# down: shutdown Harbor instance
#
# package_online:
# prepare online install package
# for example: make package_online -e DEVFLAG=false\
# REGISTRYSERVER=reg-bj.eng.vmware.com \
# REGISTRYPROJECTNAME=harborrelease
2017-06-13 11:13:24 +02:00
#
2017-03-23 05:36:36 +01:00
# package_offline:
# prepare offline install package
2017-06-13 11:13:24 +02:00
#
2017-03-23 05:36:36 +01:00
# pushimage: push Harbor images to specific registry server
# for example: make pushimage -e DEVFLAG=false REGISTRYUSER=admin \
# REGISTRYPASSWORD=***** \
# REGISTRYSERVER=reg-bj.eng.vmware.com/ \
# REGISTRYPROJECTNAME=harborrelease
# note**: need add "/" on end of REGISTRYSERVER. If not setting \
# this value will push images directly to dockerhub.
# make pushimage -e DEVFLAG=false REGISTRYUSER=vmware \
# REGISTRYPASSWORD=***** \
# REGISTRYPROJECTNAME=vmware
#
# clean: remove binary, Harbor images, specific version docker-compose \
# file, specific version tag and online/offline install package
# cleanbinary: remove adminserver, ui and jobservice binary
2017-06-13 11:13:24 +02:00
# cleanimage: remove Harbor images
# cleandockercomposefile:
# remove specific version docker-compose
2017-03-23 05:36:36 +01:00
# cleanversiontag:
# cleanpackageremove specific version tag
# cleanpackage: remove online/offline install package
2017-06-13 11:13:24 +02:00
#
2017-03-23 05:36:36 +01:00
# other example:
# clean specific version binarys and images:
# make clean -e VERSIONTAG=[TAG]
# note**: If commit new code to github, the git commit TAG will \
# change. Better use this commond clean previous images and \
2017-06-13 11:13:24 +02:00
# files with specific TAG.
2017-03-23 05:36:36 +01:00
# By default DEVFLAG=true, if you want to release new version of Harbor, \
# should setting the flag to false.
# make XXXX -e DEVFLAG=false
SHELL := /bin/bash
BUILDPATH = $( CURDIR)
MAKEPATH = $( BUILDPATH) /make
MAKEDEVPATH = $( MAKEPATH) /dev
SRCPATH = ./src
TOOLSPATH = $( BUILDPATH) /tools
UIPATH = $( BUILDPATH) /src/ui
UINGPATH = $( BUILDPATH) /src/ui_ng
GOBASEPATH = /go/src/github.com/vmware
CHECKENVCMD = checkenv.sh
BASEIMAGE = photon
COMPILETAG = compile_normal
REGISTRYSERVER =
REGISTRYPROJECTNAME = vmware
DEVFLAG = true
NOTARYFLAG = false
2017-05-19 09:19:27 +02:00
REGISTRYVERSION = 2.6.1-photon
2017-06-30 08:13:18 +02:00
NGINXVERSION = 1.11.13
2017-03-23 05:36:36 +01:00
PHOTONVERSION = 1.0
NOTARYVERSION = server-0.5.0
NOTARYSIGNERVERSION = signer-0.5.0
MARIADBVERSION = mariadb-10.1.10
HTTPPROXY =
2017-04-21 11:08:13 +02:00
REBUILDCLARITYFLAG = false
NEWCLARITYVERSION =
2017-03-23 05:36:36 +01:00
2017-06-13 11:13:24 +02:00
#clair parameters
2017-07-11 06:00:44 +02:00
CLAIRVERSION = v2.0.1-photon
2017-06-13 11:13:24 +02:00
CLAIRFLAG = false
2017-06-26 09:31:34 +02:00
CLAIRDBVERSION = 9.6.3-photon
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
#clarity parameters
2017-04-16 14:44:19 +02:00
CLARITYIMAGE = vmware/harbor-clarity-ui-builder[ :tag]
2017-06-23 11:31:05 +02:00
CLARITYSEEDPATH = /harbor_src
CLARITYUTPATH = ${ CLARITYSEEDPATH } /ui_ng/lib
2017-03-23 05:36:36 +01:00
CLARITYBUILDSCRIPT = /entrypoint.sh
# docker parameters
DOCKERCMD = $( shell which docker)
DOCKERBUILD = $( DOCKERCMD) build
DOCKERRMIMAGE = $( DOCKERCMD) rmi
DOCKERPULL = $( DOCKERCMD) pull
DOCKERIMASES = $( DOCKERCMD) images
DOCKERSAVE = $( DOCKERCMD) save
DOCKERCOMPOSECMD = $( shell which docker-compose)
DOCKERTAG = $( DOCKERCMD) tag
# go parameters
GOCMD = $( shell which go)
GOBUILD = $( GOCMD) build
GOCLEAN = $( GOCMD) clean
GOINSTALL = $( GOCMD) install
GOTEST = $( GOCMD) test
GODEP = $( GOTEST) -i
GOFMT = gofmt -w
GOBUILDIMAGE = reg.mydomain.com/library/harborgo[ :tag]
GOBUILDPATH = $( GOBASEPATH) /harbor
GOIMAGEBUILDCMD = /usr/local/go/bin/go
GOIMAGEBUILD = $( GOIMAGEBUILDCMD) build
GOBUILDPATH_ADMINSERVER = $( GOBUILDPATH) /src/adminserver
GOBUILDPATH_UI = $( GOBUILDPATH) /src/ui
GOBUILDPATH_JOBSERVICE = $( GOBUILDPATH) /src/jobservice
GOBUILDMAKEPATH = $( GOBUILDPATH) /make
GOBUILDMAKEPATH_ADMINSERVER = $( GOBUILDMAKEPATH) /dev/adminserver
GOBUILDMAKEPATH_UI = $( GOBUILDMAKEPATH) /dev/ui
GOBUILDMAKEPATH_JOBSERVICE = $( GOBUILDMAKEPATH) /dev/jobservice
GOLANGDOCKERFILENAME = Dockerfile.golang
2017-06-13 11:13:24 +02:00
# binary
2017-03-23 05:36:36 +01:00
ADMINSERVERSOURCECODE = $( SRCPATH) /adminserver
ADMINSERVERBINARYPATH = $( MAKEDEVPATH) /adminserver
ADMINSERVERBINARYNAME = harbor_adminserver
UISOURCECODE = $( SRCPATH) /ui
UIBINARYPATH = $( MAKEDEVPATH) /ui
UIBINARYNAME = harbor_ui
JOBSERVICESOURCECODE = $( SRCPATH) /jobservice
JOBSERVICEBINARYPATH = $( MAKEDEVPATH) /jobservice
JOBSERVICEBINARYNAME = harbor_jobservice
# configfile
CONFIGPATH = $( MAKEPATH)
CONFIGFILE = harbor.cfg
2017-06-13 11:13:24 +02:00
# prepare parameters
PREPAREPATH = $( TOOLSPATH)
PREPARECMD = prepare
PREPARECMD_PARA = --conf $( CONFIGPATH) /$( CONFIGFILE)
i f e q ( $( NOTARYFLAG ) , t r u e )
PREPARECMD_PARA += --with-notary
e n d i f
i f e q ( $( CLAIRFLAG ) , t r u e )
PREPARECMD_PARA += --with-clair
e n d i f
2017-03-23 05:36:36 +01:00
# makefile
MAKEFILEPATH_PHOTON = $( MAKEPATH) /photon
# common dockerfile
DOCKERFILEPATH_COMMON = $( MAKEPATH) /common
DOCKERFILEPATH_DB = $( DOCKERFILEPATH_COMMON) /db
DOCKERFILENAME_DB = Dockerfile
2017-04-21 11:08:13 +02:00
DOCKERFILE_CLARITY = $( MAKEPATH) /dev/nodeclarity/Dockerfile
2017-03-23 05:36:36 +01:00
2017-06-23 04:54:27 +02:00
DOCKERFILEPATH_POSTGRESQL = $( DOCKERFILEPATH_COMMON) /postgresql
DOCKERFILENAME_POSTGRESQL = Dockerfile
2017-03-23 05:36:36 +01:00
# docker image name
DOCKERIMAGENAME_ADMINSERVER = vmware/harbor-adminserver
DOCKERIMAGENAME_UI = vmware/harbor-ui
DOCKERIMAGENAME_JOBSERVICE = vmware/harbor-jobservice
DOCKERIMAGENAME_LOG = vmware/harbor-log
DOCKERIMAGENAME_DB = vmware/harbor-db
2017-04-21 11:08:13 +02:00
DOCKERIMAGENAME_CLATIRY = vmware/harbor-clarity-ui-builder
2017-06-26 09:31:34 +02:00
DOCKERIMAGENAME_POSTGRESQL = vmware/postgresql
2017-03-23 05:36:36 +01:00
# docker-compose files
DOCKERCOMPOSEFILEPATH = $( MAKEPATH)
DOCKERCOMPOSETPLFILENAME = docker-compose.tpl
DOCKERCOMPOSEFILENAME = docker-compose.yml
DOCKERCOMPOSENOTARYFILENAME = docker-compose.notary.yml
2017-06-13 11:13:24 +02:00
DOCKERCOMPOSECLAIRFILENAME = docker-compose.clair.yml
2017-03-23 05:36:36 +01:00
# version prepare
VERSIONFILEPATH = $( CURDIR)
VERSIONFILENAME = VERSION
GITCMD = $( shell which git)
GITTAG = $( GITCMD) describe --tags
2017-03-29 02:40:33 +02:00
GITTAGVERSION = $( shell git describe --tags || echo UNKNOWN)
2017-06-13 11:13:24 +02:00
i f e q ( $( DEVFLAG ) , t r u e )
2017-03-23 05:36:36 +01:00
VERSIONTAG = dev
2017-06-13 11:13:24 +02:00
e l s e
2017-03-27 08:33:10 +02:00
VERSIONTAG = $( GITTAGVERSION)
2017-03-23 05:36:36 +01:00
e n d i f
SEDCMD = $( shell which sed)
2017-06-13 11:13:24 +02:00
# package
2017-03-23 05:36:36 +01:00
TARCMD = $( shell which tar)
ZIPCMD = $( shell which gzip)
DOCKERIMGFILE = harbor
HARBORPKG = harbor
# pushimage
PUSHSCRIPTPATH = $( MAKEPATH)
PUSHSCRIPTNAME = pushimage.sh
REGISTRYUSER = user
REGISTRYPASSWORD = default
2017-06-13 11:13:24 +02:00
# cmds
DOCKERSAVE_PARA = $( DOCKERIMAGENAME_ADMINSERVER) :$( VERSIONTAG) \
$( DOCKERIMAGENAME_UI) :$( VERSIONTAG) \
$( DOCKERIMAGENAME_LOG) :$( VERSIONTAG) \
$( DOCKERIMAGENAME_DB) :$( VERSIONTAG) \
$( DOCKERIMAGENAME_JOBSERVICE) :$( VERSIONTAG) \
2017-06-30 08:13:18 +02:00
vmware/nginx-photon:$( NGINXVERSION) vmware/registry:$( REGISTRYVERSION) \
2017-06-13 11:13:24 +02:00
photon:$( PHOTONVERSION)
PACKAGE_OFFLINE_PARA = -zcvf harbor-offline-installer-$( GITTAGVERSION) .tgz \
$( HARBORPKG) /common/templates $( HARBORPKG) /$( DOCKERIMGFILE) .$( VERSIONTAG) .tar.gz \
$( HARBORPKG) /prepare $( HARBORPKG) /NOTICE \
$( HARBORPKG) /upgrade $( HARBORPKG) /harbor_1_1_0_template \
$( HARBORPKG) /LICENSE $( HARBORPKG) /install.sh \
$( HARBORPKG) /harbor.cfg $( HARBORPKG) /$( DOCKERCOMPOSEFILENAME)
PACKAGE_ONLINE_PARA = -zcvf harbor-online-installer-$( GITTAGVERSION) .tgz \
$( HARBORPKG) /common/templates $( HARBORPKG) /prepare \
$( HARBORPKG) /LICENSE $( HARBORPKG) /NOTICE \
$( HARBORPKG) /upgrade $( HARBORPKG) /harbor_1_1_0_template \
$( HARBORPKG) /install.sh $( HARBORPKG) /$( DOCKERCOMPOSEFILENAME) \
$( HARBORPKG) /harbor.cfg
DOCKERCOMPOSE_LIST = -f $( DOCKERCOMPOSEFILEPATH) /$( DOCKERCOMPOSEFILENAME)
i f e q ( $( NOTARYFLAG ) , t r u e )
DOCKERSAVE_PARA += vmware/notary-photon:$( NOTARYVERSION) vmware/notary-photon:$( NOTARYSIGNERVERSION) \
vmware/harbor-notary-db:$( MARIADBVERSION)
PACKAGE_OFFLINE_PARA += $( HARBORPKG) /$( DOCKERCOMPOSENOTARYFILENAME)
PACKAGE_ONLINE_PARA += $( HARBORPKG) /$( DOCKERCOMPOSENOTARYFILENAME)
DOCKERCOMPOSE_LIST += -f $( DOCKERCOMPOSEFILEPATH) /$( DOCKERCOMPOSENOTARYFILENAME)
e n d i f
i f e q ( $( CLAIRFLAG ) , t r u e )
2017-07-11 06:00:44 +02:00
DOCKERSAVE_PARA += vmware/clair:$( CLAIRVERSION) vmware/postgresql:$( CLAIRDBVERSION)
2017-06-13 11:13:24 +02:00
PACKAGE_OFFLINE_PARA += $( HARBORPKG) /$( DOCKERCOMPOSECLAIRFILENAME)
PACKAGE_ONLINE_PARA += $( HARBORPKG) /$( DOCKERCOMPOSECLAIRFILENAME)
DOCKERCOMPOSE_LIST += -f $( DOCKERCOMPOSEFILEPATH) /$( DOCKERCOMPOSECLAIRFILENAME)
e n d i f
2017-03-23 05:36:36 +01:00
version :
2017-03-27 08:33:10 +02:00
@printf $( GITTAGVERSION) > $( VERSIONFILEPATH) /$( VERSIONFILENAME) ;
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
check_environment :
@$( MAKEPATH) /$( CHECKENVCMD)
compile_adminserver :
@echo "compiling binary for adminserver..."
@$( GOBUILD) -o $( ADMINSERVERBINARYPATH) /$( ADMINSERVERBINARYNAME) $( ADMINSERVERSOURCECODE)
@echo "Done."
compile_ui :
@echo "compiling binary for ui..."
@$( GOBUILD) -o $( UIBINARYPATH) /$( UIBINARYNAME) $( UISOURCECODE)
@echo "Done."
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
compile_jobservice :
@echo "compiling binary for jobservice..."
@$( GOBUILD) -o $( JOBSERVICEBINARYPATH) /$( JOBSERVICEBINARYNAME) $( JOBSERVICESOURCECODE)
@echo "Done."
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
compile_clarity :
@echo "compiling binary for clarity ui..."
@if [ " $( HTTPPROXY) " != "" ] ; then \
2017-06-26 05:24:04 +02:00
$( DOCKERCMD) run --rm -v $( BUILDPATH) /src:$( CLARITYSEEDPATH) $( CLARITYIMAGE) $( SHELL) $( CLARITYBUILDSCRIPT) -p $( HTTPPROXY) ; \
2017-03-23 05:36:36 +01:00
else \
2017-06-26 05:24:04 +02:00
$( DOCKERCMD) run --rm -v $( BUILDPATH) /src:$( CLARITYSEEDPATH) $( CLARITYIMAGE) $( SHELL) $( CLARITYBUILDSCRIPT) ; \
2017-03-23 05:36:36 +01:00
fi
@echo "Done."
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
compile_normal : compile_clarity compile_adminserver compile_ui compile_jobservice
compile_golangimage : compile_clarity
@echo "compiling binary for adminserver (golang image)..."
@echo $( GOBASEPATH)
@echo $( GOBUILDPATH)
@$( DOCKERCMD) run --rm -v $( BUILDPATH) :$( GOBUILDPATH) -w $( GOBUILDPATH_ADMINSERVER) $( GOBUILDIMAGE) $( GOIMAGEBUILD) -v -o $( GOBUILDMAKEPATH_ADMINSERVER) /$( ADMINSERVERBINARYNAME)
@echo "Done."
@echo "compiling binary for ui (golang image)..."
@echo $( GOBASEPATH)
@echo $( GOBUILDPATH)
@$( DOCKERCMD) run --rm -v $( BUILDPATH) :$( GOBUILDPATH) -w $( GOBUILDPATH_UI) $( GOBUILDIMAGE) $( GOIMAGEBUILD) -v -o $( GOBUILDMAKEPATH_UI) /$( UIBINARYNAME)
@echo "Done."
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
@echo "compiling binary for jobservice (golang image)..."
@$( DOCKERCMD) run --rm -v $( BUILDPATH) :$( GOBUILDPATH) -w $( GOBUILDPATH_JOBSERVICE) $( GOBUILDIMAGE) $( GOIMAGEBUILD) -v -o $( GOBUILDMAKEPATH_JOBSERVICE) /$( JOBSERVICEBINARYNAME)
@echo "Done."
2017-06-13 11:13:24 +02:00
compile : check_environment $( COMPILETAG )
2017-03-23 05:36:36 +01:00
2017-06-13 11:13:24 +02:00
prepare :
@echo "preparing..."
@$( MAKEPATH) /$( PREPARECMD) $( PREPARECMD_PARA)
2017-03-23 05:36:36 +01:00
build_common : version
@echo "buildging db container for photon..."
@cd $( DOCKERFILEPATH_DB) && $( DOCKERBUILD) -f $( DOCKERFILENAME_DB) -t $( DOCKERIMAGENAME_DB) :$( VERSIONTAG) .
@echo "Done."
build_photon : build_common
make -f $( MAKEFILEPATH_PHOTON) /Makefile build -e DEVFLAG = $( DEVFLAG)
2017-06-23 04:54:27 +02:00
build_postgresql :
@echo "buildging postgresql container for photon..."
2017-06-26 09:31:34 +02:00
@cd $( DOCKERFILEPATH_POSTGRESQL) && $( DOCKERBUILD) -f $( DOCKERFILENAME_POSTGRESQL) -t $( DOCKERIMAGENAME_POSTGRESQL) :$( CLAIRDBVERSION) .
2017-06-23 04:54:27 +02:00
@echo "Done."
2017-03-23 05:36:36 +01:00
build : build_ $( BASEIMAGE )
2017-06-13 11:13:24 +02:00
modify_composefile :
2017-03-23 05:36:36 +01:00
@echo "preparing docker-compose file..."
@cp $( DOCKERCOMPOSEFILEPATH) /$( DOCKERCOMPOSETPLFILENAME) $( DOCKERCOMPOSEFILEPATH) /$( DOCKERCOMPOSEFILENAME)
@$( SEDCMD) -i 's/__version__/$(VERSIONTAG)/g' $( DOCKERCOMPOSEFILEPATH) /$( DOCKERCOMPOSEFILENAME)
2017-04-09 14:16:52 +02:00
modify_sourcefiles :
@echo "change mode of source files."
@chmod 600 $( MAKEPATH) /common/templates/notary/notary-signer.key
2017-04-11 07:06:39 +02:00
@chmod 600 $( MAKEPATH) /common/templates/notary/notary-signer.crt
@chmod 600 $( MAKEPATH) /common/templates/notary/notary-signer-ca.crt
2017-04-09 14:16:52 +02:00
@chmod 600 $( MAKEPATH) /common/templates/ui/private_key.pem
2017-04-11 07:06:39 +02:00
@chmod 600 $( MAKEPATH) /common/templates/registry/root.crt
2017-06-13 11:13:24 +02:00
2017-04-09 14:16:52 +02:00
install : compile build modify_sourcefiles prepare modify_composefile start
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
package_online : modify_composefile
@echo "packing online package ..."
@cp -r make $( HARBORPKG)
@if [ -n " $( REGISTRYSERVER) " ] ; then \
$( SEDCMD) -i 's/image\: vmware/image\: $(REGISTRYSERVER)\/$(REGISTRYPROJECTNAME)/' \
$( HARBORPKG) /docker-compose.yml ; \
fi
@cp LICENSE $( HARBORPKG) /LICENSE
@cp NOTICE $( HARBORPKG) /NOTICE
2017-04-24 10:44:02 +02:00
@cp tools/migration/migration_cfg/upgrade $( HARBORPKG) /upgrade
@cp tools/migration/migration_cfg/harbor_1_1_0_template $( HARBORPKG) /harbor_1_1_0_template
2017-03-23 05:36:36 +01:00
2017-06-13 11:13:24 +02:00
@$( TARCMD) $( PACKAGE_ONLINE_PARA)
2017-03-23 05:36:36 +01:00
@rm -rf $( HARBORPKG)
@echo "Done."
2017-06-13 11:13:24 +02:00
2017-04-09 14:16:52 +02:00
package_offline : compile build modify_sourcefiles modify_composefile
2017-03-23 05:36:36 +01:00
@echo "packing offline package ..."
@cp -r make $( HARBORPKG)
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
@cp LICENSE $( HARBORPKG) /LICENSE
@cp NOTICE $( HARBORPKG) /NOTICE
2017-04-24 10:44:02 +02:00
@cp tools/migration/migration_cfg/upgrade $( HARBORPKG) /upgrade
@cp tools/migration/migration_cfg/harbor_1_1_0_template $( HARBORPKG) /harbor_1_1_0_template
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
@echo "pulling nginx and registry..."
2017-03-23 05:40:11 +01:00
@$( DOCKERPULL) vmware/registry:$( REGISTRYVERSION)
2017-06-30 08:13:18 +02:00
@$( DOCKERPULL) vmware/nginx-photon:$( NGINXVERSION)
2017-03-23 05:36:36 +01:00
@if [ " $( NOTARYFLAG) " = "true" ] ; then \
echo "pulling notary and harbor-notary-db..." ; \
$( DOCKERPULL) vmware/notary-photon:$( NOTARYVERSION) ; \
$( DOCKERPULL) vmware/notary-photon:$( NOTARYSIGNERVERSION) ; \
$( DOCKERPULL) vmware/harbor-notary-db:$( MARIADBVERSION) ; \
fi
2017-06-13 11:13:24 +02:00
@if [ " $( CLAIRFLAG) " = "true" ] ; then \
echo "pulling claiy and postgres..." ; \
2017-07-11 06:00:44 +02:00
$( DOCKERPULL) vmware/clair:$( CLAIRVERSION) ; \
2017-06-26 09:31:34 +02:00
$( DOCKERPULL) vmware/postgresql:$( CLAIRDBVERSION) ; \
2017-03-23 05:36:36 +01:00
fi
2017-06-13 11:13:24 +02:00
@echo "saving harbor docker image"
@$( DOCKERSAVE) $( DOCKERSAVE_PARA) | gzip > $( HARBORPKG) /$( DOCKERIMGFILE) .$( VERSIONTAG) .tar.gz
@$( TARCMD) $( PACKAGE_OFFLINE_PARA)
2017-03-23 05:36:36 +01:00
@rm -rf $( HARBORPKG)
@echo "Done."
2017-06-13 11:13:24 +02:00
2017-04-21 11:08:13 +02:00
refresh_clarity_builder :
@if [ " $( REBUILDCLIATRYFLAG) " = "true" ] ; then \
echo "set http proxy.." ; \
if [ " $( HTTPPROXY) " != "" ] ; then \
$( SEDCMD) -i 's/__proxy__/--proxy $(HTTPPROXY)/g' $( DOCKERFILE_CLARITY) ; \
else \
$( SEDCMD) -i 's/__proxy__/ /g' $( DOCKERFILE_CLARITY) ; \
fi ; \
echo "build new clarity image.." ; \
$( DOCKERBUILD) -f $( DOCKERFILE_CLARITY) -t $( DOCKERIMAGENAME_CLATIRY) :$( NEWCLARITYVERSION) . ; \
echo "push clarity image.." ; \
$( DOCKERTAG) $( DOCKERIMAGENAME_CLATIRY) :$( NEWCLARITYVERSION) $( DOCKERIMAGENAME_CLATIRY) :$( NEWCLARITYVERSION) ; \
$( PUSHSCRIPTPATH) /$( PUSHSCRIPTNAME) $( REGISTRYSERVER) $( DOCKERIMAGENAME_CLATIRY) :$( NEWCLARITYVERSION) \
$( REGISTRYUSER) $( REGISTRYPASSWORD) $( REGISTRYSERVER) ; \
echo "remove local clarity image.." ; \
$( DOCKERRMIMAGE) $( REGISTRYSERVER) $( DOCKERIMAGENAME_ADMINSERVER) :$( NEWCLARITYVERSION) ; \
fi
2017-03-23 05:36:36 +01:00
2017-05-05 09:20:35 +02:00
run_clarity_ut :
@echo "run clarity ut ..."
2017-06-23 11:31:05 +02:00
@$( DOCKERCMD) run --rm -v $( UINGPATH) /lib:$( CLARITYSEEDPATH) -v $( BUILDPATH) /tests:$( CLARITYSEEDPATH) /tests $( CLARITYIMAGE) $( SHELL) $( CLARITYSEEDPATH) /tests/run-clarity-ut.sh
2017-05-05 09:20:35 +02:00
2017-03-23 05:36:36 +01:00
pushimage :
@echo "pushing harbor images ..."
@$( DOCKERTAG) $( DOCKERIMAGENAME_ADMINSERVER) :$( VERSIONTAG) $( REGISTRYSERVER) $( DOCKERIMAGENAME_ADMINSERVER) :$( VERSIONTAG)
@$( PUSHSCRIPTPATH) /$( PUSHSCRIPTNAME) $( REGISTRYSERVER) $( DOCKERIMAGENAME_ADMINSERVER) :$( VERSIONTAG) \
$( REGISTRYUSER) $( REGISTRYPASSWORD) $( REGISTRYSERVER)
@$( DOCKERRMIMAGE) $( REGISTRYSERVER) $( DOCKERIMAGENAME_ADMINSERVER) :$( VERSIONTAG)
@$( DOCKERTAG) $( DOCKERIMAGENAME_UI) :$( VERSIONTAG) $( REGISTRYSERVER) $( DOCKERIMAGENAME_UI) :$( VERSIONTAG)
@$( PUSHSCRIPTPATH) /$( PUSHSCRIPTNAME) $( REGISTRYSERVER) $( DOCKERIMAGENAME_UI) :$( VERSIONTAG) \
$( REGISTRYUSER) $( REGISTRYPASSWORD) $( REGISTRYSERVER)
@$( DOCKERRMIMAGE) $( REGISTRYSERVER) $( DOCKERIMAGENAME_UI) :$( VERSIONTAG)
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
@$( DOCKERTAG) $( DOCKERIMAGENAME_JOBSERVICE) :$( VERSIONTAG) $( REGISTRYSERVER) $( DOCKERIMAGENAME_JOBSERVICE) :$( VERSIONTAG)
@$( PUSHSCRIPTPATH) /$( PUSHSCRIPTNAME) $( REGISTRYSERVER) $( DOCKERIMAGENAME_JOBSERVICE) :$( VERSIONTAG) \
$( REGISTRYUSER) $( REGISTRYPASSWORD) $( REGISTRYSERVER)
@$( DOCKERRMIMAGE) $( REGISTRYSERVER) $( DOCKERIMAGENAME_JOBSERVICE) :$( VERSIONTAG)
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
@$( DOCKERTAG) $( DOCKERIMAGENAME_LOG) :$( VERSIONTAG) $( REGISTRYSERVER) $( DOCKERIMAGENAME_LOG) :$( VERSIONTAG)
@$( PUSHSCRIPTPATH) /$( PUSHSCRIPTNAME) $( REGISTRYSERVER) $( DOCKERIMAGENAME_LOG) :$( VERSIONTAG) \
$( REGISTRYUSER) $( REGISTRYPASSWORD) $( REGISTRYSERVER)
@$( DOCKERRMIMAGE) $( REGISTRYSERVER) $( DOCKERIMAGENAME_LOG) :$( VERSIONTAG)
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
@$( DOCKERTAG) $( DOCKERIMAGENAME_DB) :$( VERSIONTAG) $( REGISTRYSERVER) $( DOCKERIMAGENAME_DB) :$( VERSIONTAG)
@$( PUSHSCRIPTPATH) /$( PUSHSCRIPTNAME) $( REGISTRYSERVER) $( DOCKERIMAGENAME_DB) :$( VERSIONTAG) \
$( REGISTRYUSER) $( REGISTRYPASSWORD) $( REGISTRYSERVER)
@$( DOCKERRMIMAGE) $( REGISTRYSERVER) $( DOCKERIMAGENAME_DB) :$( VERSIONTAG)
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
start :
@echo "loading harbor images..."
2017-06-13 11:13:24 +02:00
@$( DOCKERCOMPOSECMD) $( DOCKERCOMPOSE_LIST) up -d
2017-03-23 05:36:36 +01:00
@echo "Start complete. You can visit harbor now."
2017-06-13 11:13:24 +02:00
2017-03-23 05:36:36 +01:00
down :
2017-06-13 11:13:24 +02:00
@echo "Please make sure to set -e NOTARYFLAG=true/CLAIRFLAG=true if you are using Notary/CLAIR in Harbor, otherwise the Notary/CLAIR containers cannot be stop automaticlly."
2017-03-23 05:36:36 +01:00
@while [ -z " $$ CONTINUE " ] ; do \
read -r -p "Type anything but Y or y to exit. [Y/N]: " CONTINUE; \
done ; \
[ $$ CONTINUE = "y" ] || [ $$ CONTINUE = "Y" ] || ( echo "Exiting." ; exit 1; )
@echo "stoping harbor instance..."
2017-06-13 11:13:24 +02:00
@$( DOCKERCOMPOSECMD) $( DOCKERCOMPOSE_LIST) down -v
2017-03-23 05:36:36 +01:00
@echo "Done."
cleanbinary :
@echo "cleaning binary..."
@if [ -f $( ADMINSERVERBINARYPATH) /$( ADMINSERVERBINARYNAME) ] ; then rm $( ADMINSERVERBINARYPATH) /$( ADMINSERVERBINARYNAME) ; fi
@if [ -f $( UIBINARYPATH) /$( UIBINARYNAME) ] ; then rm $( UIBINARYPATH) /$( UIBINARYNAME) ; fi
@if [ -f $( JOBSERVICEBINARYPATH) /$( JOBSERVICEBINARYNAME) ] ; then rm $( JOBSERVICEBINARYPATH) /$( JOBSERVICEBINARYNAME) ; fi
cleanimage :
@echo "cleaning image for photon..."
- $( DOCKERRMIMAGE) -f $( DOCKERIMAGENAME_ADMINSERVER) :$( VERSIONTAG)
- $( DOCKERRMIMAGE) -f $( DOCKERIMAGENAME_UI) :$( VERSIONTAG)
- $( DOCKERRMIMAGE) -f $( DOCKERIMAGENAME_DB) :$( VERSIONTAG)
- $( DOCKERRMIMAGE) -f $( DOCKERIMAGENAME_JOBSERVICE) :$( VERSIONTAG)
- $( DOCKERRMIMAGE) -f $( DOCKERIMAGENAME_LOG) :$( VERSIONTAG)
# - $(DOCKERRMIMAGE) -f registry:$(REGISTRYVERSION)
# - $(DOCKERRMIMAGE) -f nginx:1.11.5
cleandockercomposefile :
@echo " cleaning $( DOCKERCOMPOSEFILEPATH) /docker-compose.yml "
@if [ -f $( DOCKERCOMPOSEFILEPATH) /docker-compose.yml ] ; then rm $( DOCKERCOMPOSEFILEPATH) /docker-compose.yml ; fi
cleanversiontag :
@echo "cleaning version TAG"
2017-06-13 11:13:24 +02:00
@rm -rf $( VERSIONFILEPATH) /$( VERSIONFILENAME)
2017-03-23 05:36:36 +01:00
cleanpackage :
@echo "cleaning harbor install package"
@if [ -d $( BUILDPATH) /harbor ] ; then rm -rf $( BUILDPATH) /harbor ; fi
2017-03-27 08:33:10 +02:00
@if [ -f $( BUILDPATH) /harbor-online-installer-$( GITTAGVERSION) .tgz ] ; \
then rm $( BUILDPATH) /harbor-online-installer-$( GITTAGVERSION) .tgz ; fi
@if [ -f $( BUILDPATH) /harbor-offline-installer-$( GITTAGVERSION) .tgz ] ; \
2017-06-13 11:13:24 +02:00
then rm $( BUILDPATH) /harbor-offline-installer-$( GITTAGVERSION) .tgz ; fi
2017-03-23 05:36:36 +01:00
.PHONY : cleanall
cleanall : cleanbinary cleanimage cleandockercomposefile cleanversiontag cleanpackage
2017-06-13 11:13:24 +02:00
clean :
2017-03-23 05:36:36 +01:00
@echo " make cleanall: remove binary, Harbor images, specific version docker-compose"
@echo " file, specific version tag, online and offline install package"
@echo " make cleanbinary: remove ui and jobservice binary"
@echo " make cleanimage: remove Harbor images"
@echo " make cleandockercomposefile: remove specific version docker-compose"
@echo " make cleanversiontag: cleanpackageremove specific version tag"
@echo " make cleanpackage: remove online and offline install package"
all : install