mirror of https://github.com/goharbor/harbor.git
Merge cc0c20c8bc
into c004f2d3e6
This commit is contained in:
commit
89aa645548
15
Makefile
15
Makefile
|
@ -72,7 +72,10 @@ TOOLSPATH=$(BUILDPATH)/tools
|
||||||
CORE_PATH=$(BUILDPATH)/src/core
|
CORE_PATH=$(BUILDPATH)/src/core
|
||||||
PORTAL_PATH=$(BUILDPATH)/src/portal
|
PORTAL_PATH=$(BUILDPATH)/src/portal
|
||||||
CHECKENVCMD=checkenv.sh
|
CHECKENVCMD=checkenv.sh
|
||||||
|
ARCH ?= $(shell uname -m)
|
||||||
|
ifeq ($(ARCH), aarch64)
|
||||||
|
ARCH := arm64
|
||||||
|
endif
|
||||||
# parameters
|
# parameters
|
||||||
REGISTRYSERVER=
|
REGISTRYSERVER=
|
||||||
REGISTRYPROJECTNAME=goharbor
|
REGISTRYPROJECTNAME=goharbor
|
||||||
|
@ -122,9 +125,15 @@ DISTRIBUTION_SRC=https://github.com/goharbor/distribution.git
|
||||||
|
|
||||||
# dependency binaries
|
# dependency binaries
|
||||||
REGISTRYURL=https://storage.googleapis.com/harbor-builds/bin/registry/release-${REGISTRYVERSION}/registry
|
REGISTRYURL=https://storage.googleapis.com/harbor-builds/bin/registry/release-${REGISTRYVERSION}/registry
|
||||||
TRIVY_DOWNLOAD_URL=https://github.com/aquasecurity/trivy/releases/download/$(TRIVYVERSION)/trivy_$(TRIVYVERSION:v%=%)_Linux-64bit.tar.gz
|
ifeq ($(ARCH), arm64)
|
||||||
TRIVY_ADAPTER_DOWNLOAD_URL=https://github.com/goharbor/harbor-scanner-trivy/archive/refs/tags/$(TRIVYADAPTERVERSION).tar.gz
|
TRIVY_DOWNLOAD_URL = https://github.com/aquasecurity/trivy/releases/download/$(TRIVYVERSION)/trivy_$(TRIVYVERSION:v%=%)_Linux-ARM64.tar.gz
|
||||||
|
|
||||||
|
else
|
||||||
|
TRIVY_DOWNLOAD_URL = https://github.com/aquasecurity/trivy/releases/download/$(TRIVYVERSION)/trivy_$(TRIVYVERSION:v%=%)_Linux-64bit.tar.gz
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
TRIVY_ADAPTER_DOWNLOAD_URL=https://github.com/goharbor/harbor-scanner-trivy/archive/refs/tags/$(TRIVYADAPTERVERSION).tar.gz
|
||||||
define VERSIONS_FOR_PREPARE
|
define VERSIONS_FOR_PREPARE
|
||||||
VERSION_TAG: $(VERSIONTAG)
|
VERSION_TAG: $(VERSIONTAG)
|
||||||
REGISTRY_VERSION: $(REGISTRYVERSION)
|
REGISTRY_VERSION: $(REGISTRYVERSION)
|
||||||
|
|
|
@ -15,10 +15,13 @@ SEDCMD=$(shell which sed)
|
||||||
WGET=$(shell which wget)
|
WGET=$(shell which wget)
|
||||||
CURL=$(shell which curl)
|
CURL=$(shell which curl)
|
||||||
TIMESTAMP=$(shell date +"%Y%m%d")
|
TIMESTAMP=$(shell date +"%Y%m%d")
|
||||||
|
ARCH ?= $(shell uname -m)
|
||||||
|
PLATFORM = $(if $(filter $(ARCH),aarch64 arm64),linux/arm64,linux/amd64)
|
||||||
|
|
||||||
|
|
||||||
# docker parameters
|
# docker parameters
|
||||||
DOCKERCMD=$(shell which docker)
|
DOCKERCMD=$(shell which docker)
|
||||||
DOCKERBUILD=$(DOCKERCMD) build --no-cache --network=$(DOCKERNETWORK)
|
DOCKERBUILD=$(DOCKERCMD) build --no-cache --network=$(DOCKERNETWORK) --platform=$(PLATFORM)
|
||||||
DOCKERBUILD_WITH_PULL_PARA=$(DOCKERBUILD) --pull=$(PULL_BASE_FROM_DOCKERHUB)
|
DOCKERBUILD_WITH_PULL_PARA=$(DOCKERBUILD) --pull=$(PULL_BASE_FROM_DOCKERHUB)
|
||||||
DOCKERRMIMAGE=$(DOCKERCMD) rmi
|
DOCKERRMIMAGE=$(DOCKERCMD) rmi
|
||||||
DOCKERIMAGES=$(DOCKERCMD) images
|
DOCKERIMAGES=$(DOCKERCMD) images
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
services:
|
services:
|
||||||
log:
|
log:
|
||||||
image: goharbor/harbor-log:{{version}}
|
image: goharbor/harbor-log:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: harbor-log
|
container_name: harbor-log
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
|
@ -24,6 +25,7 @@ services:
|
||||||
- harbor
|
- harbor
|
||||||
registry:
|
registry:
|
||||||
image: goharbor/registry-photon:{{reg_version}}
|
image: goharbor/registry-photon:{{reg_version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: registry
|
container_name: registry
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
|
@ -68,6 +70,7 @@ services:
|
||||||
tag: "registry"
|
tag: "registry"
|
||||||
registryctl:
|
registryctl:
|
||||||
image: goharbor/harbor-registryctl:{{version}}
|
image: goharbor/harbor-registryctl:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: registryctl
|
container_name: registryctl
|
||||||
env_file:
|
env_file:
|
||||||
- ./common/config/registryctl/env
|
- ./common/config/registryctl/env
|
||||||
|
@ -112,6 +115,7 @@ services:
|
||||||
{% if external_database == False %}
|
{% if external_database == False %}
|
||||||
postgresql:
|
postgresql:
|
||||||
image: goharbor/harbor-db:{{version}}
|
image: goharbor/harbor-db:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: harbor-db
|
container_name: harbor-db
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
|
@ -138,6 +142,7 @@ services:
|
||||||
{% endif %}
|
{% endif %}
|
||||||
core:
|
core:
|
||||||
image: goharbor/harbor-core:{{version}}
|
image: goharbor/harbor-core:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: harbor-core
|
container_name: harbor-core
|
||||||
env_file:
|
env_file:
|
||||||
- ./common/config/core/env
|
- ./common/config/core/env
|
||||||
|
@ -194,6 +199,7 @@ services:
|
||||||
tag: "core"
|
tag: "core"
|
||||||
portal:
|
portal:
|
||||||
image: goharbor/harbor-portal:{{version}}
|
image: goharbor/harbor-portal:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: harbor-portal
|
container_name: harbor-portal
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
|
@ -227,6 +233,7 @@ services:
|
||||||
|
|
||||||
jobservice:
|
jobservice:
|
||||||
image: goharbor/harbor-jobservice:{{version}}
|
image: goharbor/harbor-jobservice:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: harbor-jobservice
|
container_name: harbor-jobservice
|
||||||
env_file:
|
env_file:
|
||||||
- ./common/config/jobservice/env
|
- ./common/config/jobservice/env
|
||||||
|
@ -265,6 +272,7 @@ services:
|
||||||
{% if external_redis == False %}
|
{% if external_redis == False %}
|
||||||
redis:
|
redis:
|
||||||
image: goharbor/redis-photon:{{redis_version}}
|
image: goharbor/redis-photon:{{redis_version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: redis
|
container_name: redis
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
|
@ -287,6 +295,7 @@ services:
|
||||||
{% endif %}
|
{% endif %}
|
||||||
proxy:
|
proxy:
|
||||||
image: goharbor/nginx-photon:{{version}}
|
image: goharbor/nginx-photon:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: nginx
|
container_name: nginx
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
|
@ -336,6 +345,7 @@ services:
|
||||||
trivy-adapter:
|
trivy-adapter:
|
||||||
container_name: trivy-adapter
|
container_name: trivy-adapter
|
||||||
image: goharbor/trivy-adapter-photon:{{trivy_adapter_version}}
|
image: goharbor/trivy-adapter-photon:{{trivy_adapter_version}}
|
||||||
|
platform: {{platform}}
|
||||||
restart: always
|
restart: always
|
||||||
cap_drop:
|
cap_drop:
|
||||||
- ALL
|
- ALL
|
||||||
|
@ -375,6 +385,7 @@ services:
|
||||||
{% if metric.enabled %}
|
{% if metric.enabled %}
|
||||||
exporter:
|
exporter:
|
||||||
image: goharbor/harbor-exporter:{{version}}
|
image: goharbor/harbor-exporter:{{version}}
|
||||||
|
platform: {{platform}}
|
||||||
container_name: harbor-exporter
|
container_name: harbor-exporter
|
||||||
env_file:
|
env_file:
|
||||||
- ./common/config/exporter/env
|
- ./common/config/exporter/env
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
from g import templates_dir
|
from g import templates_dir
|
||||||
from .configs import parse_versions
|
from .configs import parse_versions
|
||||||
from .jinja import render_jinja
|
from .jinja import render_jinja
|
||||||
|
@ -59,4 +59,10 @@ def prepare_docker_compose(configs, with_trivy):
|
||||||
if metric:
|
if metric:
|
||||||
rendering_variables['metric'] = metric
|
rendering_variables['metric'] = metric
|
||||||
|
|
||||||
|
arch = platform.machine()
|
||||||
|
if arch == "aarch64":
|
||||||
|
rendering_variables['platform'] = "linux/arm64"
|
||||||
|
else:
|
||||||
|
rendering_variables['platform'] = "linux/amd64"
|
||||||
|
|
||||||
render_jinja(docker_compose_template_path, docker_compose_yml_path, mode=0o644, **rendering_variables)
|
render_jinja(docker_compose_template_path, docker_compose_yml_path, mode=0o644, **rendering_variables)
|
||||||
|
|
Loading…
Reference in New Issue