2016-10-19 08:32:00 +02:00
|
|
|
# Makefile for a harbor project
|
|
|
|
#
|
|
|
|
# Targets:
|
|
|
|
#
|
2016-10-24 08:06:23 +02:00
|
|
|
# build: build harbor ubuntu images
|
2016-10-19 08:32:00 +02:00
|
|
|
# clean: clean ui and jobservice harbor images
|
|
|
|
|
|
|
|
# common
|
|
|
|
SHELL := /bin/bash
|
|
|
|
BUILDPATH=$(CURDIR)
|
2016-10-24 08:06:23 +02:00
|
|
|
MAKEPATH=$(BUILDPATH)/make
|
|
|
|
MAKEDEVPATH=$(MAKEPATH)/dev
|
2016-10-19 08:32:00 +02:00
|
|
|
SRCPATH=./src
|
|
|
|
TOOLSPATH=$(BUILDPATH)/tools
|
|
|
|
CHECKENVCMD=checkenv.sh
|
2016-10-24 08:06:23 +02:00
|
|
|
DEVFLAG=true
|
2016-10-19 08:32:00 +02:00
|
|
|
|
|
|
|
# docker parameters
|
|
|
|
DOCKERCMD=$(shell which docker)
|
|
|
|
DOCKERBUILD=$(DOCKERCMD) build
|
|
|
|
DOCKERRMIMAGE=$(DOCKERCMD) rmi
|
|
|
|
DOCKERIMASES=$(DOCKERCMD) images
|
|
|
|
|
|
|
|
# binary
|
|
|
|
UISOURCECODE=$(SRCPATH)/ui
|
2016-10-24 08:06:23 +02:00
|
|
|
UIBINARYPATH=$(MAKEDEVPATH)/ui
|
2016-10-19 08:32:00 +02:00
|
|
|
UIBINARYNAME=harbor_ui
|
|
|
|
JOBSERVICESOURCECODE=$(SRCPATH)/jobservice
|
2016-10-24 08:06:23 +02:00
|
|
|
JOBSERVICEBINARYPATH=$(MAKEDEVPATH)/jobservice
|
2016-10-19 08:32:00 +02:00
|
|
|
JOBSERVICEBINARYNAME=harbor_jobservice
|
|
|
|
|
2016-10-24 08:06:23 +02:00
|
|
|
# ubuntu dockerfile
|
|
|
|
DOCKERFILEPATH=$(MAKEPATH)/ubuntu
|
2016-10-19 08:32:00 +02:00
|
|
|
DOCKERFILEPATH_UI=$(DOCKERFILEPATH)/ui
|
|
|
|
DOCKERFILENAME_UI=Dockerfile
|
|
|
|
DOCKERIMAGENAME_UI=vmware/harbor-ui
|
|
|
|
DOCKERFILEPATH_JOBSERVICE=$(DOCKERFILEPATH)/jobservice
|
|
|
|
DOCKERFILENAME_JOBSERVICE=Dockerfile
|
|
|
|
DOCKERIMAGENAME_JOBSERVICE=vmware/harbor-jobservice
|
|
|
|
DOCKERFILEPATH_LOG=$(DOCKERFILEPATH)/log
|
|
|
|
DOCKERFILENAME_LOG=Dockerfile
|
|
|
|
DOCKERIMAGENAME_LOG=vmware/harbor-log
|
|
|
|
|
|
|
|
# version prepare
|
|
|
|
VERSIONFILEPATH=$(SRCPATH)/views/sections
|
|
|
|
VERSIONFILENAME=header-content.htm
|
|
|
|
GITCMD=$(shell which git)
|
|
|
|
GITTAG=$(GITCMD) describe --tags
|
2016-10-24 08:06:23 +02:00
|
|
|
ifeq ($(DEVFLAG), true)
|
|
|
|
VERSIONTAG=dev
|
|
|
|
else
|
|
|
|
VERSIONTAG=$(shell $(GITTAG))
|
|
|
|
endif
|
2016-10-19 08:32:00 +02:00
|
|
|
|
|
|
|
check_environment:
|
2016-10-24 08:06:23 +02:00
|
|
|
@$(MAKEPATH)/$(CHECKENVCMD)
|
2016-10-19 08:32:00 +02:00
|
|
|
|
2016-10-24 08:06:23 +02:00
|
|
|
build:
|
|
|
|
@echo "building ui container for ubuntu..."
|
2016-10-19 08:32:00 +02:00
|
|
|
$(DOCKERBUILD) -f $(DOCKERFILEPATH_UI)/$(DOCKERFILENAME_UI) -t $(DOCKERIMAGENAME_UI):$(VERSIONTAG) .
|
|
|
|
@echo "Done."
|
|
|
|
|
2016-10-24 08:06:23 +02:00
|
|
|
@echo "building jobservice container for ubuntu..."
|
2016-10-19 08:32:00 +02:00
|
|
|
$(DOCKERBUILD) -f $(DOCKERFILEPATH_JOBSERVICE)/$(DOCKERFILENAME_JOBSERVICE) -t $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) .
|
|
|
|
@echo "Done."
|
|
|
|
|
2016-10-24 08:06:23 +02:00
|
|
|
@echo "building log container for ubuntu..."
|
2016-10-19 08:32:00 +02:00
|
|
|
$(DOCKERBUILD) -f $(DOCKERFILEPATH_LOG)/$(DOCKERFILENAME_LOG) -t $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) .
|
|
|
|
@echo "Done."
|
|
|
|
|
|
|
|
cleanimage:
|
2016-10-24 08:06:23 +02:00
|
|
|
@echo "cleaning image for ubuntu..."
|
2016-10-19 08:32:00 +02:00
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_UI):$(VERSIONTAG)
|
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean: cleanimage
|
|
|
|
|