2016-10-19 08:32:00 +02:00
|
|
|
# Makefile for a harbor project
|
2019-10-10 09:29:50 +02:00
|
|
|
#
|
2016-10-19 08:32:00 +02:00
|
|
|
# Targets:
|
|
|
|
#
|
2016-10-26 07:46:22 +02:00
|
|
|
# build: build harbor photon images
|
2019-02-22 09:34:26 +01:00
|
|
|
# clean: clean core and jobservice harbor images
|
2016-10-19 08:32:00 +02:00
|
|
|
|
|
|
|
# common
|
|
|
|
SHELL := /bin/bash
|
|
|
|
BUILDPATH=$(CURDIR)
|
2016-10-24 08:06:23 +02:00
|
|
|
MAKEPATH=$(BUILDPATH)/make
|
2016-10-19 08:32:00 +02:00
|
|
|
SRCPATH=./src
|
2018-06-01 08:58:43 +02:00
|
|
|
TOOLSPATH=$(CURDIR)/tools
|
2017-12-09 19:53:12 +01:00
|
|
|
SEDCMD=$(shell which sed)
|
|
|
|
WGET=$(shell which wget)
|
2020-04-01 13:46:45 +02:00
|
|
|
CURL=$(shell which curl)
|
2021-06-02 10:04:29 +02:00
|
|
|
TIMESTAMP=$(shell date +"%Y%m%d")
|
2016-10-19 08:32:00 +02:00
|
|
|
|
|
|
|
# docker parameters
|
|
|
|
DOCKERCMD=$(shell which docker)
|
2021-06-02 10:04:29 +02:00
|
|
|
DOCKERBUILD=$(DOCKERCMD) build --no-cache
|
|
|
|
DOCKERBUILD_WITH_PULL_PARA=$(DOCKERBUILD) --pull=$(PULL_BASE_FROM_DOCKERHUB)
|
2016-10-19 08:32:00 +02:00
|
|
|
DOCKERRMIMAGE=$(DOCKERCMD) rmi
|
2020-06-16 12:18:55 +02:00
|
|
|
DOCKERIMAGES=$(DOCKERCMD) images
|
2022-01-20 05:14:29 +01:00
|
|
|
IMAGENAMESPACE=goharbor
|
2020-04-01 13:46:45 +02:00
|
|
|
BASEIMAGENAMESPACE=goharbor
|
2016-10-19 08:32:00 +02:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
# pushimage
|
|
|
|
PUSHSCRIPTPATH=$(MAKEPATH)
|
|
|
|
PUSHSCRIPTNAME=pushimage.sh
|
|
|
|
|
2019-02-22 09:34:26 +01:00
|
|
|
# binary
|
2018-09-12 08:38:29 +02:00
|
|
|
CORE_SOURCECODE=$(SRCPATH)/core
|
|
|
|
CORE_BINARYNAME=harbor_core
|
2016-10-19 08:32:00 +02:00
|
|
|
JOBSERVICESOURCECODE=$(SRCPATH)/jobservice
|
|
|
|
JOBSERVICEBINARYNAME=harbor_jobservice
|
|
|
|
|
2016-10-26 07:46:22 +02:00
|
|
|
# photon dockerfile
|
|
|
|
DOCKERFILEPATH=$(MAKEPATH)/photon
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
PREPARE=prepare
|
|
|
|
DOCKERFILEPATH_PREPARE=$(DOCKERFILEPATH)/$(PREPARE)
|
2019-03-18 08:07:19 +01:00
|
|
|
DOCKERFILENAME_PREPARE=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_PREPARE=$(IMAGENAMESPACE)/$(PREPARE)
|
2019-03-18 08:07:19 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
PORTAL=portal
|
|
|
|
DOCKERFILEPATH_PORTAL=$(DOCKERFILEPATH)/$(PORTAL)
|
2018-09-05 09:48:16 +02:00
|
|
|
DOCKERFILENAME_PORTAL=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_PORTAL=$(IMAGENAMESPACE)/harbor-$(PORTAL)
|
2018-09-05 09:48:16 +02:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
CORE=core
|
|
|
|
DOCKERFILEPATH_CORE=$(DOCKERFILEPATH)/$(CORE)
|
2018-09-12 08:38:29 +02:00
|
|
|
DOCKERFILENAME_CORE=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_CORE=$(IMAGENAMESPACE)/harbor-$(CORE)
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
JOBSERVICE=jobservice
|
|
|
|
DOCKERFILEPATH_JOBSERVICE=$(DOCKERFILEPATH)/$(JOBSERVICE)
|
2016-10-19 08:32:00 +02:00
|
|
|
DOCKERFILENAME_JOBSERVICE=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_JOBSERVICE=$(IMAGENAMESPACE)/harbor-$(JOBSERVICE)
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
LOG=log
|
|
|
|
DOCKERFILEPATH_LOG=$(DOCKERFILEPATH)/$(LOG)
|
2016-10-19 08:32:00 +02:00
|
|
|
DOCKERFILENAME_LOG=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_LOG=$(IMAGENAMESPACE)/harbor-$(LOG)
|
2016-10-19 08:32:00 +02:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
DB=db
|
|
|
|
DOCKERFILEPATH_DB=$(DOCKERFILEPATH)/$(DB)
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERFILENAME_DB=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_DB=$(IMAGENAMESPACE)/harbor-$(DB)
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
POSTGRESQL=postgresql
|
|
|
|
DOCKERFILEPATH_POSTGRESQL=$(DOCKERFILEPATH)/$(POSTGRESQL)
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERFILENAME_POSTGRESQL=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_POSTGRESQL=$(IMAGENAMESPACE)/$(POSTGRESQL)-photon
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
TRIVY_ADAPTER=trivy-adapter
|
|
|
|
DOCKERFILEPATH_TRIVY_ADAPTER=$(DOCKERFILEPATH)/$(TRIVY_ADAPTER)
|
2020-02-10 16:46:26 +01:00
|
|
|
DOCKERFILENAME_TRIVY_ADAPTER=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_TRIVY_ADAPTER=$(IMAGENAMESPACE)/$(TRIVY_ADAPTER)-photon
|
2020-02-10 16:46:26 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
NGINX=nginx
|
|
|
|
DOCKERFILEPATH_NGINX=$(DOCKERFILEPATH)/$(NGINX)
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERFILENAME_NGINX=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_NGINX=$(IMAGENAMESPACE)/$(NGINX)-photon
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
REGISTRY=registry
|
|
|
|
DOCKERFILEPATH_REG=$(DOCKERFILEPATH)/$(REGISTRY)
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERFILENAME_REG=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_REG=$(IMAGENAMESPACE)/$(REGISTRY)-photon
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
REGISTRYCTL=registryctl
|
|
|
|
DOCKERFILEPATH_REGISTRYCTL=$(DOCKERFILEPATH)/$(REGISTRYCTL)
|
2018-07-16 10:50:28 +02:00
|
|
|
DOCKERFILENAME_REGISTRYCTL=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_REGISTRYCTL=$(IMAGENAMESPACE)/harbor-$(REGISTRYCTL)
|
2018-07-16 10:50:28 +02:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
NOTARYSERVER=notary-server
|
|
|
|
NOTARYSIGNER=notary-signer
|
2017-12-09 19:53:12 +01:00
|
|
|
DOCKERFILEPATH_NOTARY=$(DOCKERFILEPATH)/notary
|
2021-06-02 10:04:29 +02:00
|
|
|
DOCKERFILEPATH_NOTARYSERVER=$(DOCKERFILEPATH)/$(NOTARYSERVER)
|
2019-11-11 11:56:36 +01:00
|
|
|
DOCKERFILENAME_NOTARYSERVER=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_NOTARYSERVER=$(IMAGENAMESPACE)/$(NOTARYSERVER)-photon
|
2021-06-02 10:04:29 +02:00
|
|
|
DOCKERFILEPATH_NOTARYSIGNER=$(DOCKERFILEPATH)/$(NOTARYSIGNER)
|
|
|
|
DOCKERFILENAME_NOTARYSIGNER=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_NOTARYSIGNER=$(IMAGENAMESPACE)/$(NOTARYSIGNER)-photon
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
REDIS=redis
|
|
|
|
DOCKERFILEPATH_REDIS=$(DOCKERFILEPATH)/$(REDIS)
|
2018-03-30 07:22:10 +02:00
|
|
|
DOCKERFILENAME_REDIS=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_REDIS=$(IMAGENAMESPACE)/$(REDIS)-photon
|
2018-03-30 07:22:10 +02:00
|
|
|
|
2020-07-13 10:57:09 +02:00
|
|
|
DOCKERFILEPATH_STANDALONE_DB_MIGRATOR=$(DOCKERFILEPATH)/standalone-db-migrator
|
|
|
|
DOCKERFILENAME_STANDALONE_DB_MIGRATOR=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_STANDALONE_DB_MIGRATOR=$(IMAGENAMESPACE)/standalone-db-migrator
|
2020-07-13 10:57:09 +02:00
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
EXPORTER=exporter
|
|
|
|
DOCKERFILEPATH_EXPORTER=$(DOCKERFILEPATH)/$(EXPORTER)
|
2021-03-24 10:10:53 +01:00
|
|
|
DOCKERFILENAME_EXPORTER=Dockerfile
|
2022-01-20 05:14:29 +01:00
|
|
|
DOCKERIMAGENAME_EXPORTER=$(IMAGENAMESPACE)/harbor-$(EXPORTER)
|
2020-07-13 10:57:09 +02:00
|
|
|
|
2018-07-19 10:47:05 +02:00
|
|
|
# for chart server (chartmuseum)
|
2021-06-02 10:04:29 +02:00
|
|
|
CHARTSERVER=chartserver
|
|
|
|
DOCKERFILEPATH_CHART_SERVER=$(DOCKERFILEPATH)/$(CHARTSERVER)
|
2018-07-19 10:47:05 +02:00
|
|
|
DOCKERFILENAME_CHART_SERVER=Dockerfile
|
2019-10-20 15:10:55 +02:00
|
|
|
CHART_SERVER_CODE_BASE=https://github.com/helm/chartmuseum.git
|
2018-07-19 10:47:05 +02:00
|
|
|
CHART_SERVER_MAIN_PATH=cmd/chartmuseum
|
|
|
|
CHART_SERVER_BIN_NAME=chartm
|
|
|
|
|
2019-03-18 08:07:19 +01:00
|
|
|
_build_prepare:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(PREPARE),$(DOCKERFILEPATH_PREPARE))
|
2019-03-18 08:07:19 +01:00
|
|
|
@echo "building prepare container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_PREPARE)/$(DOCKERFILENAME_PREPARE) -t $(DOCKERIMAGENAME_PREPARE):$(VERSIONTAG) .
|
2019-03-18 08:07:19 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
2018-04-27 11:27:12 +02:00
|
|
|
_build_db:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(DB),$(DOCKERFILEPATH_DB))
|
2017-12-09 19:53:12 +01:00
|
|
|
@echo "building db container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_DB)/$(DOCKERFILENAME_DB) -t $(DOCKERIMAGENAME_DB):$(VERSIONTAG) .
|
2017-12-09 19:53:12 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
2018-09-05 09:48:16 +02:00
|
|
|
_build_portal:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(PORTAL),$(DOCKERFILEPATH_PORTAL))
|
2018-09-05 09:48:16 +02:00
|
|
|
@echo "building portal container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) --build-arg npm_registry=$(NPM_REGISTRY) -f $(DOCKERFILEPATH_PORTAL)/$(DOCKERFILENAME_PORTAL) -t $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) .
|
2018-09-05 09:48:16 +02:00
|
|
|
@echo "Done."
|
|
|
|
|
2019-10-10 09:29:50 +02:00
|
|
|
_build_core:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(CORE),$(DOCKERFILEPATH_CORE))
|
2018-09-12 08:38:29 +02:00
|
|
|
@echo "building core container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_CORE)/$(DOCKERFILENAME_CORE) -t $(DOCKERIMAGENAME_CORE):$(VERSIONTAG) .
|
2016-10-19 08:32:00 +02:00
|
|
|
@echo "Done."
|
2019-10-10 09:29:50 +02:00
|
|
|
|
|
|
|
_build_jobservice:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(JOBSERVICE),$(DOCKERFILEPATH_JOBSERVICE))
|
2016-10-26 07:46:22 +02:00
|
|
|
@echo "building jobservice container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_JOBSERVICE)/$(DOCKERFILENAME_JOBSERVICE) -t $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG) .
|
2016-10-19 08:32:00 +02:00
|
|
|
@echo "Done."
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2019-10-10 09:29:50 +02:00
|
|
|
_build_log:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(LOG),$(DOCKERFILEPATH_LOG))
|
2016-10-26 07:46:22 +02:00
|
|
|
@echo "building log container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_LOG)/$(DOCKERFILENAME_LOG) -t $(DOCKERIMAGENAME_LOG):$(VERSIONTAG) .
|
2016-10-19 08:32:00 +02:00
|
|
|
@echo "Done."
|
2017-12-09 19:53:12 +01:00
|
|
|
|
2020-02-10 16:46:26 +01:00
|
|
|
_build_trivy_adapter:
|
|
|
|
@if [ "$(TRIVYFLAG)" = "true" ] ; then \
|
2021-06-02 10:04:29 +02:00
|
|
|
$(call _build_base,$(TRIVY_ADAPTER),$(DOCKERFILEPATH_TRIVY_ADAPTER)) ; \
|
2020-02-13 15:32:57 +01:00
|
|
|
rm -rf $(DOCKERFILEPATH_TRIVY_ADAPTER)/binary && mkdir -p $(DOCKERFILEPATH_TRIVY_ADAPTER)/binary ; \
|
|
|
|
echo "Downloading Trivy scanner $(TRIVYVERSION)..." ; \
|
2020-02-14 11:58:51 +01:00
|
|
|
$(call _extract_archive, $(TRIVY_DOWNLOAD_URL), $(DOCKERFILEPATH_TRIVY_ADAPTER)/binary/) ; \
|
2020-02-10 16:46:26 +01:00
|
|
|
if [ "$(BUILDBIN)" != "true" ] ; then \
|
2020-02-13 15:32:57 +01:00
|
|
|
echo "Downloading Trivy adapter $(TRIVYADAPTERVERSION)..." ; \
|
2020-02-14 11:58:51 +01:00
|
|
|
$(call _extract_archive, $(TRIVY_ADAPTER_DOWNLOAD_URL), $(DOCKERFILEPATH_TRIVY_ADAPTER)/binary/) ; \
|
2020-02-13 15:32:57 +01:00
|
|
|
else \
|
|
|
|
echo "Building Trivy adapter $(TRIVYADAPTERVERSION) from sources..." ; \
|
|
|
|
cd $(DOCKERFILEPATH_TRIVY_ADAPTER) && $(DOCKERFILEPATH_TRIVY_ADAPTER)/builder.sh $(TRIVYADAPTERVERSION) && cd - ; \
|
2020-02-10 16:46:26 +01:00
|
|
|
fi ; \
|
2020-02-13 15:32:57 +01:00
|
|
|
echo "Building Trivy adapter container for photon..." ; \
|
2021-06-02 10:04:29 +02:00
|
|
|
$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) \
|
2020-04-01 13:46:45 +02:00
|
|
|
--build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) \
|
2020-02-13 15:32:57 +01:00
|
|
|
--build-arg trivy_version=$(TRIVYVERSION) \
|
|
|
|
-f $(DOCKERFILEPATH_TRIVY_ADAPTER)/$(DOCKERFILENAME_TRIVY_ADAPTER) \
|
2021-06-02 10:04:29 +02:00
|
|
|
-t $(DOCKERIMAGENAME_TRIVY_ADAPTER):$(VERSIONTAG) . ; \
|
2020-02-10 16:46:26 +01:00
|
|
|
rm -rf $(DOCKERFILEPATH_TRIVY_ADAPTER)/binary; \
|
|
|
|
echo "Done." ; \
|
|
|
|
fi
|
|
|
|
|
2018-07-19 10:47:05 +02:00
|
|
|
_build_chart_server:
|
|
|
|
@if [ "$(CHARTFLAG)" = "true" ] ; then \
|
2021-06-02 10:04:29 +02:00
|
|
|
$(call _build_base,$(CHARTSERVER),$(DOCKERFILEPATH_CHART_SERVER)); \
|
2018-07-19 10:47:05 +02:00
|
|
|
if [ "$(BUILDBIN)" != "true" ] ; then \
|
|
|
|
rm -rf $(DOCKERFILEPATH_CHART_SERVER)/binary && mkdir -p $(DOCKERFILEPATH_CHART_SERVER)/binary && \
|
2020-04-01 13:46:45 +02:00
|
|
|
$(call _get_binary, $(CHARTURL), $(DOCKERFILEPATH_CHART_SERVER)/binary/chartm); \
|
2018-07-19 10:47:05 +02:00
|
|
|
else \
|
2020-06-15 18:20:18 +02:00
|
|
|
cd $(DOCKERFILEPATH_CHART_SERVER) && $(DOCKERFILEPATH_CHART_SERVER)/builder $(GOBUILDIMAGE) $(CHART_SERVER_CODE_BASE) $(CHARTMUSEUM_SRC_TAG) $(CHART_SERVER_MAIN_PATH) $(CHART_SERVER_BIN_NAME) && cd - ; \
|
2018-07-19 10:47:05 +02:00
|
|
|
fi ; \
|
|
|
|
echo "building chartmuseum container for photon..." ; \
|
2021-06-02 10:04:29 +02:00
|
|
|
$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_CHART_SERVER)/$(DOCKERFILENAME_CHART_SERVER) -t $(DOCKERIMAGENAME_CHART_SERVER):$(VERSIONTAG) . ; \
|
2018-07-19 10:47:05 +02:00
|
|
|
rm -rf $(DOCKERFILEPATH_CHART_SERVER)/binary; \
|
|
|
|
echo "Done." ; \
|
|
|
|
fi
|
2019-10-10 09:29:50 +02:00
|
|
|
|
2017-12-09 19:53:12 +01:00
|
|
|
_build_nginx:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(NGINX),$(DOCKERFILEPATH_NGINX))
|
2017-12-09 19:53:12 +01:00
|
|
|
@echo "building nginx container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_NGINX)/$(DOCKERFILENAME_NGINX) -t $(DOCKERIMAGENAME_NGINX):$(VERSIONTAG) .
|
2017-12-09 19:53:12 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
|
|
|
_build_notary:
|
|
|
|
@if [ "$(NOTARYFLAG)" = "true" ] ; then \
|
2021-06-02 10:04:29 +02:00
|
|
|
$(call _build_base,$(NOTARYSERVER),$(DOCKERFILEPATH_NOTARYSERVER)) ; \
|
|
|
|
$(call _build_base,$(NOTARYSIGNER),$(DOCKERFILEPATH_NOTARYSIGNER)) ; \
|
2017-12-09 19:53:12 +01:00
|
|
|
if [ "$(BUILDBIN)" != "true" ] ; then \
|
|
|
|
rm -rf $(DOCKERFILEPATH_NOTARY)/binary && mkdir -p $(DOCKERFILEPATH_NOTARY)/binary && \
|
2021-04-17 09:55:02 +02:00
|
|
|
$(call _get_binary, $(NOTARYURL), $(DOCKERFILEPATH_NOTARY)/binary-bundle.tgz); \
|
2019-02-19 05:51:37 +01:00
|
|
|
cd $(DOCKERFILEPATH_NOTARY) && tar -zvxf binary-bundle.tgz && cd - ; \
|
2017-12-09 19:53:12 +01:00
|
|
|
else \
|
2019-02-19 05:51:37 +01:00
|
|
|
cd $(DOCKERFILEPATH_NOTARY) && $(DOCKERFILEPATH_NOTARY)/builder $(NOTARYVERSION) $(NOTARYMIGRATEVERSION) && cd - ; \
|
2017-12-09 19:53:12 +01:00
|
|
|
fi ; \
|
|
|
|
echo "building notary container for photon..."; \
|
2021-06-02 10:04:29 +02:00
|
|
|
chmod 655 $(DOCKERFILEPATH_NOTARY)/binary/notary-signer && $(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_NOTARYSIGNER)/$(DOCKERFILENAME_NOTARYSIGNER) -t $(DOCKERIMAGENAME_NOTARYSIGNER):$(VERSIONTAG) . ; \
|
|
|
|
chmod 655 $(DOCKERFILEPATH_NOTARY)/binary/notary-server && $(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_NOTARYSERVER)/$(DOCKERFILENAME_NOTARYSERVER) -t $(DOCKERIMAGENAME_NOTARYSERVER):$(VERSIONTAG) . ; \
|
2017-12-09 19:53:12 +01:00
|
|
|
rm -rf $(DOCKERFILEPATH_NOTARY)/binary; \
|
|
|
|
echo "Done."; \
|
|
|
|
fi
|
2019-10-10 09:29:50 +02:00
|
|
|
|
2017-12-09 19:53:12 +01:00
|
|
|
_build_registry:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(REGISTRY),$(DOCKERFILEPATH_REG))
|
2017-12-09 19:53:12 +01:00
|
|
|
@if [ "$(BUILDBIN)" != "true" ] ; then \
|
|
|
|
rm -rf $(DOCKERFILEPATH_REG)/binary && mkdir -p $(DOCKERFILEPATH_REG)/binary && \
|
2020-04-01 13:46:45 +02:00
|
|
|
$(call _get_binary, $(REGISTRYURL), $(DOCKERFILEPATH_REG)/binary/registry); \
|
2017-12-09 19:53:12 +01:00
|
|
|
else \
|
2019-10-20 15:10:55 +02:00
|
|
|
cd $(DOCKERFILEPATH_REG) && $(DOCKERFILEPATH_REG)/builder $(REGISTRY_SRC_TAG) && cd - ; \
|
2017-12-09 19:53:12 +01:00
|
|
|
fi
|
|
|
|
@echo "building registry container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@chmod 655 $(DOCKERFILEPATH_REG)/binary/registry && $(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_REG)/$(DOCKERFILENAME_REG) -t $(DOCKERIMAGENAME_REG):$(VERSIONTAG) .
|
2018-07-16 10:50:28 +02:00
|
|
|
@echo "Done."
|
|
|
|
|
2019-10-10 09:29:50 +02:00
|
|
|
_build_registryctl:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(REGISTRYCTL),$(DOCKERFILEPATH_REGISTRYCTL))
|
2018-07-16 10:50:28 +02:00
|
|
|
@echo "building registry controller for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_REGISTRYCTL)/$(DOCKERFILENAME_REGISTRYCTL) -t $(DOCKERIMAGENAME_REGISTRYCTL):$(VERSIONTAG) .
|
2017-12-09 19:53:12 +01:00
|
|
|
@rm -rf $(DOCKERFILEPATH_REG)/binary
|
|
|
|
@echo "Done."
|
|
|
|
|
2018-03-30 07:22:10 +02:00
|
|
|
_build_redis:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(REDIS),$(DOCKERFILEPATH_REDIS))
|
2018-03-30 07:22:10 +02:00
|
|
|
@echo "building redis container for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_REDIS)/$(DOCKERFILENAME_REDIS) -t $(DOCKERIMAGENAME_REDIS):$(VERSIONTAG) .
|
2018-03-30 07:22:10 +02:00
|
|
|
@echo "Done."
|
|
|
|
|
2020-07-13 10:57:09 +02:00
|
|
|
_build_standalone_db_migrator:
|
|
|
|
@echo "building standalone db migrator image for photon..."
|
2021-06-02 10:04:29 +02:00
|
|
|
$(DOCKERBUILD_WITH_PULL_PARA) --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) -f $(DOCKERFILEPATH_STANDALONE_DB_MIGRATOR)/$(DOCKERFILENAME_STANDALONE_DB_MIGRATOR) -t $(DOCKERIMAGENAME_STANDALONE_DB_MIGRATOR):$(VERSIONTAG) .
|
2020-07-13 10:57:09 +02:00
|
|
|
@echo "Done."
|
|
|
|
|
2021-03-24 10:10:53 +01:00
|
|
|
_compile_and_build_exporter:
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(call _build_base,$(EXPORTER),$(DOCKERFILEPATH_EXPORTER))
|
2021-03-24 10:10:53 +01:00
|
|
|
@echo "compiling and building image for exporter..."
|
2021-06-02 10:04:29 +02:00
|
|
|
@$(DOCKERCMD) build --build-arg harbor_base_image_version=$(BASEIMAGETAG) --build-arg harbor_base_namespace=$(BASEIMAGENAMESPACE) --build-arg build_image=$(GOBUILDIMAGE) -f ${DOCKERFILEPATH_EXPORTER}/${DOCKERFILENAME_EXPORTER} -t $(DOCKERIMAGENAME_EXPORTER):$(VERSIONTAG) .
|
2021-03-24 10:10:53 +01:00
|
|
|
@echo "Done."
|
|
|
|
|
2019-10-26 19:25:36 +02:00
|
|
|
define _extract_archive
|
2020-04-01 13:46:45 +02:00
|
|
|
echo "download $1";\
|
|
|
|
$(CURL) --connect-timeout 30 -f -k -L $1 | tar xvz -C $2 || exit 1
|
2019-10-26 19:25:36 +02:00
|
|
|
endef
|
|
|
|
|
2017-12-09 19:53:12 +01:00
|
|
|
define _get_binary
|
2020-04-01 13:46:45 +02:00
|
|
|
echo "download $1";\
|
|
|
|
$(CURL) --connect-timeout 30 -f -k -L $1 -o $2 || exit 1
|
2017-12-09 19:53:12 +01:00
|
|
|
endef
|
|
|
|
|
2021-06-02 10:04:29 +02:00
|
|
|
define _build_base
|
|
|
|
if [ "$(BUILD_BASE)" = "true" ] ; then \
|
|
|
|
echo "building base image for $(1)...";\
|
|
|
|
if [ -n "$(REGISTRYUSER)" ] && [ -n "$(REGISTRYPASSWORD)" ] ; then \
|
|
|
|
docker login -u $(REGISTRYUSER) -p $(REGISTRYPASSWORD) ; \
|
|
|
|
else \
|
|
|
|
echo "No docker credentials provided, please be aware of priviledges to access docker hub!" ; \
|
|
|
|
fi ;\
|
2021-06-16 09:18:40 +02:00
|
|
|
if [ "$(1)" = "db" ] && [ "$(BUILD_PG96)" = "true" ]; then \
|
|
|
|
echo "build pg96 rpm package." ; \
|
|
|
|
cd $(DOCKERFILEPATH)/db && $(DOCKERFILEPATH)/db/rpm_builder.sh && cd - ; \
|
|
|
|
$(DOCKERBUILD) --pull --no-cache -f $(DOCKERFILEPATH)/db/Dockerfile.pg96 -t $(BASEIMAGENAMESPACE)/harbor-db-base:$(BASEIMAGETAG) --label base-build-date=$(TIMESTAMP) . ; \
|
|
|
|
else \
|
|
|
|
$(DOCKERBUILD) -f $(2)/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-$(1)-base:$(BASEIMAGETAG) --label base-build-date=$(TIMESTAMP) . ;\
|
|
|
|
fi ;\
|
2021-06-02 10:04:29 +02:00
|
|
|
if [ "$(PUSHBASEIMAGE)" = "true" ] ; then \
|
2021-06-16 09:18:40 +02:00
|
|
|
$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(BASEIMAGENAMESPACE)/harbor-$(1)-base:$(BASEIMAGETAG) $(REGISTRYUSER) $(REGISTRYPASSWORD) docker.io $(PULL_BASE_FROM_DOCKERHUB) || exit 1; \
|
2021-06-02 10:04:29 +02:00
|
|
|
fi ; \
|
|
|
|
fi
|
|
|
|
endef
|
2021-03-24 10:10:53 +01:00
|
|
|
|
|
|
|
build: _build_prepare _build_db _build_portal _build_core _build_jobservice _build_log _build_nginx _build_registry _build_registryctl _build_notary _build_trivy_adapter _build_redis _build_chart_server _compile_and_build_exporter
|
2021-06-16 09:18:40 +02:00
|
|
|
@if [ -n "$(REGISTRYUSER)" ] && [ -n "$(REGISTRYPASSWORD)" ] ; then \
|
|
|
|
docker logout ; \
|
|
|
|
fi
|
2016-10-19 08:32:00 +02:00
|
|
|
cleanimage:
|
2016-10-26 07:46:22 +02:00
|
|
|
@echo "cleaning image for photon..."
|
2018-09-05 09:48:16 +02:00
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
|
2018-09-12 08:38:29 +02:00
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_CORE):$(VERSIONTAG)
|
2016-10-19 08:32:00 +02:00
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_JOBSERVICE):$(VERSIONTAG)
|
|
|
|
- $(DOCKERRMIMAGE) -f $(DOCKERIMAGENAME_LOG):$(VERSIONTAG)
|
2019-10-10 09:29:50 +02:00
|
|
|
|
2016-10-19 08:32:00 +02:00
|
|
|
.PHONY: clean
|
|
|
|
clean: cleanimage
|
|
|
|
|