This commit is contained in:
Mandepudi Rani Chowdary 2025-10-01 15:04:59 -04:00 committed by GitHub
commit 89aa645548
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 36 additions and 7 deletions

View File

@ -72,7 +72,10 @@ TOOLSPATH=$(BUILDPATH)/tools
CORE_PATH=$(BUILDPATH)/src/core
PORTAL_PATH=$(BUILDPATH)/src/portal
CHECKENVCMD=checkenv.sh
ARCH ?= $(shell uname -m)
ifeq ($(ARCH), aarch64)
ARCH := arm64
endif
# parameters
REGISTRYSERVER=
REGISTRYPROJECTNAME=goharbor
@ -122,9 +125,15 @@ DISTRIBUTION_SRC=https://github.com/goharbor/distribution.git
# dependency binaries
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
TRIVY_ADAPTER_DOWNLOAD_URL=https://github.com/goharbor/harbor-scanner-trivy/archive/refs/tags/$(TRIVYADAPTERVERSION).tar.gz
ifeq ($(ARCH), arm64)
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
VERSION_TAG: $(VERSIONTAG)
REGISTRY_VERSION: $(REGISTRYVERSION)
@ -613,4 +622,4 @@ clean:
@echo " make cleandockercomposefile: remove specific version docker-compose"
@echo " make cleanpackage: remove online and offline install package"
all: install
all: install

View File

@ -15,10 +15,13 @@ SEDCMD=$(shell which sed)
WGET=$(shell which wget)
CURL=$(shell which curl)
TIMESTAMP=$(shell date +"%Y%m%d")
ARCH ?= $(shell uname -m)
PLATFORM = $(if $(filter $(ARCH),aarch64 arm64),linux/arm64,linux/amd64)
# docker parameters
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)
DOCKERRMIMAGE=$(DOCKERCMD) rmi
DOCKERIMAGES=$(DOCKERCMD) images

View File

@ -17,4 +17,4 @@ RUN tdnf install -y gzip postgresql15-server findutils bc >> /dev/null \
&& sed -i "s|#unix_socket_directories = '/tmp'.*|unix_socket_directories = '/run/postgresql'|g" /usr/pgsql/15/share/postgresql/postgresql.conf.sample \
&& tdnf clean all
RUN tdnf erase -y toybox && tdnf install -y util-linux net-tools
RUN tdnf erase -y toybox && tdnf install -y util-linux net-tools

View File

@ -1,6 +1,7 @@
services:
log:
image: goharbor/harbor-log:{{version}}
platform: {{platform}}
container_name: harbor-log
restart: always
cap_drop:
@ -24,6 +25,7 @@ services:
- harbor
registry:
image: goharbor/registry-photon:{{reg_version}}
platform: {{platform}}
container_name: registry
restart: always
cap_drop:
@ -68,6 +70,7 @@ services:
tag: "registry"
registryctl:
image: goharbor/harbor-registryctl:{{version}}
platform: {{platform}}
container_name: registryctl
env_file:
- ./common/config/registryctl/env
@ -112,6 +115,7 @@ services:
{% if external_database == False %}
postgresql:
image: goharbor/harbor-db:{{version}}
platform: {{platform}}
container_name: harbor-db
restart: always
cap_drop:
@ -138,6 +142,7 @@ services:
{% endif %}
core:
image: goharbor/harbor-core:{{version}}
platform: {{platform}}
container_name: harbor-core
env_file:
- ./common/config/core/env
@ -194,6 +199,7 @@ services:
tag: "core"
portal:
image: goharbor/harbor-portal:{{version}}
platform: {{platform}}
container_name: harbor-portal
restart: always
cap_drop:
@ -227,6 +233,7 @@ services:
jobservice:
image: goharbor/harbor-jobservice:{{version}}
platform: {{platform}}
container_name: harbor-jobservice
env_file:
- ./common/config/jobservice/env
@ -265,6 +272,7 @@ services:
{% if external_redis == False %}
redis:
image: goharbor/redis-photon:{{redis_version}}
platform: {{platform}}
container_name: redis
restart: always
cap_drop:
@ -287,6 +295,7 @@ services:
{% endif %}
proxy:
image: goharbor/nginx-photon:{{version}}
platform: {{platform}}
container_name: nginx
restart: always
cap_drop:
@ -336,6 +345,7 @@ services:
trivy-adapter:
container_name: trivy-adapter
image: goharbor/trivy-adapter-photon:{{trivy_adapter_version}}
platform: {{platform}}
restart: always
cap_drop:
- ALL
@ -375,6 +385,7 @@ services:
{% if metric.enabled %}
exporter:
image: goharbor/harbor-exporter:{{version}}
platform: {{platform}}
container_name: harbor-exporter
env_file:
- ./common/config/exporter/env

View File

@ -1,5 +1,5 @@
import os
import platform
from g import templates_dir
from .configs import parse_versions
from .jinja import render_jinja
@ -58,5 +58,11 @@ def prepare_docker_compose(configs, with_trivy):
metric = configs.get('metric')
if 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)