Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ TOOLSPATH=$(BUILDPATH)/tools
CORE_PATH=$(BUILDPATH)/src/core
PORTAL_PATH=$(BUILDPATH)/src/portal
CHECKENVCMD=checkenv.sh
ARCH ?= $(shell uname -m)

# parameters
REGISTRYSERVER=
REGISTRYPROJECTNAME=goharbor
DEVFLAG=true
TRIVYFLAG=false
TRIVYFLAG=true
EXPORTERFLAG=false
HTTPPROXY=
BUILDREG=true
Expand Down Expand Up @@ -122,8 +123,31 @@ 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)


# Arm64-specific version and source values
TRIVYVERSION=v0.58.2
TRIVYADAPTERVERSION=v0.32.3
REGISTRY_SRC_TAG=v2.8.3
DISTRIBUTION_SRC=https://github.com/distribution/distribution.git
TRIVY_DOWNLOAD_URL=https://github.com/aquasecurity/trivy/releases/download/$(TRIVYVERSION)/trivy_$(TRIVYVERSION)_Linux-ARM64.tar.gz
TRIVY_ADAPTER_DOWNLOAD_URL=https://github.com/goharbor/harbor-scanner-trivy/archive/refs/tags/$(TRIVYADAPTERVERSION).tar.gz


else

# Default (x86_64 or others) versions
TRIVYVERSION=v0.61.0
TRIVYADAPTERVERSION=v0.33.0-rc.2
REGISTRY_SRC_TAG=release/2.8
DISTRIBUTION_SRC=https://github.com/goharbor/distribution.git
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

endif


define VERSIONS_FOR_PREPARE
VERSION_TAG: $(VERSIONTAG)
Expand Down
5 changes: 4 additions & 1 deletion make/photon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions make/photon/db/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,16 @@ RUN tdnf install -y shadow >> /dev/null \
&& groupadd -r postgres --gid=999 \
&& useradd -m -r -g postgres --uid=999 postgres

RUN tdnf install -y postgresql14-server >> /dev/null
RUN tdnf install -y gzip postgresql15-server findutils bc >> /dev/null \
&& mkdir -p /docker-entrypoint-initdb.d \
# Detect architecture and install different packages accordingly
ARG TARGETARCH
RUN if [ "$TARGETARCH" = "amd64" ]; then \
tdnf install -y postgresql14-server gzip postgresql15-server findutils bc >> /dev/null; \
else \
tdnf install -y postgresql15-server gzip findutils bc >> /dev/null; \
fi


RUN mkdir -p /docker-entrypoint-initdb.d \
&& mkdir -p /run/postgresql \
&& chown -R postgres:postgres /run/postgresql \
&& chmod 2777 /run/postgresql \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
services:
log:
image: goharbor/harbor-log:{{version}}
platform: {{platform}}
container_name: harbor-log
restart: always
cap_drop:
Expand All @@ -24,6 +25,7 @@ services:
- harbor
registry:
image: goharbor/registry-photon:{{reg_version}}
platform: {{platform}}
container_name: registry
restart: always
cap_drop:
Expand Down Expand Up @@ -68,6 +70,7 @@ services:
tag: "registry"
registryctl:
image: goharbor/harbor-registryctl:{{version}}
platform: {{platform}}
container_name: registryctl
env_file:
- ./common/config/registryctl/env
Expand Down Expand Up @@ -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:
Expand All @@ -138,6 +142,7 @@ services:
{% endif %}
core:
image: goharbor/harbor-core:{{version}}
platform: {{platform}}
container_name: harbor-core
env_file:
- ./common/config/core/env
Expand Down Expand Up @@ -194,6 +199,7 @@ services:
tag: "core"
portal:
image: goharbor/harbor-portal:{{version}}
platform: {{platform}}
container_name: harbor-portal
restart: always
cap_drop:
Expand Down Expand Up @@ -227,6 +233,7 @@ services:

jobservice:
image: goharbor/harbor-jobservice:{{version}}
platform: {{platform}}
container_name: harbor-jobservice
env_file:
- ./common/config/jobservice/env
Expand Down Expand Up @@ -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:
Expand All @@ -287,6 +295,7 @@ services:
{% endif %}
proxy:
image: goharbor/nginx-photon:{{version}}
platform: {{platform}}
container_name: nginx
restart: always
cap_drop:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion make/photon/prepare/utils/docker_compose.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os

import platform
from g import templates_dir
from .configs import parse_versions
from .jinja import render_jinja
Expand Down Expand Up @@ -58,5 +58,15 @@ def prepare_docker_compose(configs, with_trivy):
metric = configs.get('metric')
if metric:
rendering_variables['metric'] = metric
# for metrics
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)
Loading