# SPDX-License-Identifier: Apache-2.0

#     Copyright (c) 2025 SUSE LLC

# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon.

#
#
#

# Please submit bugfixes or comments via https://bugs.opensuse.org/
# You can contact the BCI team via https://github.com/SUSE/bci/discussions

#!UseOBSRepositories
#!BuildTag: private-registry/harbor-core:%%harbor_patch_version%%-%RELEASE%
#!BuildTag: private-registry/harbor-core:%%harbor_patch_version%%
#!BuildTag: private-registry/harbor-core:%%harbor_minor_version%%
#!BuildTag: private-registry/harbor-core:latest

#!BuildName: private-registry-harbor-core-%%harbor_patch_version%%
#!BuildVersion: 15.6.%%harbor_patch_version%%
#!BuildRelease: 1
FROM registry.suse.com/bci/bci-micro:15.6 AS target
FROM suse/sle15:15.6 AS builder
COPY --from=target / /target

RUN set -euo pipefail; \
    zypper -n --installroot /target --gpg-auto-import-keys install --no-recommends harbor213-core harbor-entrypoint; \
    zypper -n clean; \
    rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}
FROM registry.suse.com/bci/bci-micro:15.6
COPY --from=builder /target /
# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=com.suse.application.harbor-core
LABEL org.opencontainers.image.authors="https://github.com/SUSE/bci/discussions"
LABEL org.opencontainers.image.title="Harbor Core for SUSE Private Registry"
LABEL org.opencontainers.image.description="Harbor Core Container for SUSE Private Registry"
LABEL org.opencontainers.image.version="%%harbor_patch_version%%"
LABEL org.opencontainers.image.url="https://www.suse.com/products/base-container-images/"
LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="SUSE LLC"
LABEL org.opencontainers.image.source="%SOURCEURL%"
LABEL org.opencontainers.image.ref.name="%%harbor_patch_version%%-%RELEASE%"
LABEL org.opensuse.reference="registry.suse.com/private-registry/harbor-core:%%harbor_patch_version%%-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL com.suse.supportlevel="techpreview"
LABEL com.suse.eula="sle-eula"
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle#suse-linux-enterprise-server-15"
LABEL com.suse.release-stage="released"
# endlabelprefix
LABEL org.opencontainers.image.base.name="%BASE_REFNAME%"
LABEL org.opencontainers.image.base.digest="%BASE_DIGEST%"
LABEL io.artifacthub.package.readme-url="%SOURCEURL%README.md"

RUN chown -R harbor:harbor /usr/share/factory/var/lib/ca-certificates

USER harbor

ENTRYPOINT [ "entrypoint.sh", "harbor_core" ]
WORKDIR /usr/share/harbor
