mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 03:35:21 +01:00
Add base image for exporter
* Add base * update Makefile Signed-off-by: DQ <dengq@vmware.com>
This commit is contained in:
parent
9ef50ed430
commit
f5fcc7bd31
9
Makefile
9
Makefile
@ -374,12 +374,7 @@ compile_standalone_db_migrator:
|
||||
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATHINCONTAINER) -w $(GOBUILDPATH_STANDALONE_DB_MIGRATOR) $(GOBUILDIMAGE) $(GOIMAGEBUILD_COMMON) -o $(GOBUILDPATHINCONTAINER)/$(GOBUILDMAKEPATH_STANDALONE_DB_MIGRATOR)/$(STANDALONE_DB_MIGRATOR_BINARYNAME)
|
||||
@echo "Done."
|
||||
|
||||
compile_exporter:
|
||||
@echo "compiling binary for exporter (golang image)..."
|
||||
@$(DOCKERCMD) build -f ${GOBUILDMAKEPATH_EXPORTER}/Dockerfile --build-arg build_image=$(GOBUILDIMAGE) -t $(DOCKERIMAGENAME_EXPORTER):$(VERSIONTAG) .
|
||||
@echo "Done."
|
||||
|
||||
compile: check_environment versions_prepare compile_core compile_jobservice compile_registryctl compile_notary_migrate_patch compile_exporter
|
||||
compile: check_environment versions_prepare compile_core compile_jobservice compile_registryctl compile_notary_migrate_patch
|
||||
|
||||
update_prepare_version:
|
||||
@echo "substitute the prepare version tag in prepare file..."
|
||||
@ -416,7 +411,7 @@ build_base_docker:
|
||||
else \
|
||||
echo "No docker credentials provided, please make sure enough priviledges to access docker hub!" ; \
|
||||
fi
|
||||
@for name in chartserver trivy-adapter core db jobservice log nginx notary-server notary-signer portal prepare redis registry registryctl; do \
|
||||
@for name in chartserver trivy-adapter core db jobservice log nginx notary-server notary-signer portal prepare redis registry registryctl exporter; do \
|
||||
echo $$name ; \
|
||||
sleep 30 ; \
|
||||
$(DOCKERBUILD) --pull --no-cache -f $(MAKEFILEPATH_PHOTON)/$$name/Dockerfile.base -t $(BASEIMAGENAMESPACE)/harbor-$$name-base:$(BASEIMAGETAG) --label base-build-date=$(date +"%Y%m%d") . && \
|
||||
|
@ -91,6 +91,9 @@ DOCKERFILEPATH_STANDALONE_DB_MIGRATOR=$(DOCKERFILEPATH)/standalone-db-migrator
|
||||
DOCKERFILENAME_STANDALONE_DB_MIGRATOR=Dockerfile
|
||||
DOCKERIMAGENAME_STANDALONE_DB_MIGRATOR=goharbor/standalone-db-migrator
|
||||
|
||||
DOCKERFILEPATH_EXPORTER=$(DOCKERFILEPATH)/exporter
|
||||
DOCKERFILENAME_EXPORTER=Dockerfile
|
||||
DOCKERIMAGENAME_EXPORTER=goharbor/harbor-exporter
|
||||
|
||||
# for chart server (chartmuseum)
|
||||
DOCKERFILEPATH_CHART_SERVER=$(DOCKERFILEPATH)/chartserver
|
||||
@ -213,6 +216,11 @@ _build_standalone_db_migrator:
|
||||
@$(DOCKERBUILD) --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) .
|
||||
@echo "Done."
|
||||
|
||||
_compile_and_build_exporter:
|
||||
@echo "compiling and building image for exporter..."
|
||||
@$(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) .
|
||||
@echo "Done."
|
||||
|
||||
define _extract_archive
|
||||
echo "download $1";\
|
||||
$(CURL) --connect-timeout 30 -f -k -L $1 | tar xvz -C $2 || exit 1
|
||||
@ -223,7 +231,9 @@ define _get_binary
|
||||
$(CURL) --connect-timeout 30 -f -k -L $1 -o $2 || exit 1
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
|
||||
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
|
||||
|
||||
cleanimage:
|
||||
@echo "cleaning image for photon..."
|
||||
|
@ -1,4 +1,7 @@
|
||||
ARG build_image
|
||||
ARG harbor_base_image_version
|
||||
ARG harbor_base_namespace
|
||||
|
||||
FROM ${build_image} AS build
|
||||
|
||||
ENV CGO_ENABLED=0
|
||||
@ -9,12 +12,7 @@ COPY src /harbor/src
|
||||
WORKDIR /harbor/src/cmd/exporter
|
||||
RUN go build -o /out/harbor_exporter
|
||||
|
||||
FROM photon:2.0
|
||||
|
||||
RUN tdnf install -y tzdata shadow >> /dev/null \
|
||||
&& tdnf clean all \
|
||||
&& groupadd -r -g 10000 harbor && useradd --no-log-init -r -m -g 10000 -u 10000 harbor \
|
||||
&& mkdir /harbor/
|
||||
FROM ${harbor_base_namespace}/harbor-exporter-base:${harbor_base_image_version}
|
||||
|
||||
COPY --from=build /out/harbor_exporter /harbor/harbor_exporter
|
||||
COPY ./make/photon/exporter/entrypoint.sh ./make/photon/common/install_cert.sh /harbor/
|
||||
|
6
make/photon/exporter/Dockerfile.base
Normal file
6
make/photon/exporter/Dockerfile.base
Normal file
@ -0,0 +1,6 @@
|
||||
FROM photon:2.0
|
||||
|
||||
RUN tdnf install -y tzdata shadow >> /dev/null \
|
||||
&& tdnf clean all \
|
||||
&& groupadd -r -g 10000 harbor && useradd --no-log-init -r -m -g 10000 -u 10000 harbor \
|
||||
&& mkdir /harbor/
|
Loading…
Reference in New Issue
Block a user