# SPDX-License-Identifier: MIT

#     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.

# The content of THIS FILE IS AUTOGENERATED and should not be manually modified.
# It is maintained by the BCI team and generated by
# https://github.com/SUSE/BCI-dockerfile-generator

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

#!UseOBSRepositories
#!ExclusiveArch: x86_64 aarch64
#!BuildTag: bci/dotnet-runtime:10.0.0-%RELEASE%
#!BuildTag: bci/dotnet-runtime:10.0.0
#!BuildTag: bci/dotnet-runtime:10.0
#!BuildTag: bci/dotnet-runtime:latest
#!BuildName: bci-dotnet-runtime-10.0
#!BuildVersion: 15.7.10.0
FROM registry.suse.com/bci/bci-base:15.7



# set the day of last password change to empty
RUN set -euo pipefail; sed -i 's/^\([^:]*:[^:]*:\)[^:]*\(:.*\)$/\1\2/' /etc/shadow

# Define labels according to https://en.opensuse.org/Building_derived_containers
# labelprefix=com.suse.bci.dotnet.runtime
LABEL org.opencontainers.image.authors="https://github.com/SUSE/bci/discussions"
LABEL org.opencontainers.image.title="SLE BCI .NET Runtime 10.0"
LABEL org.opencontainers.image.description="The .NET Runtime 10.0 based on the SUSE Linux Enterprise Base Container Image. The .NET packages contained in this image come from a 3rd-party repository http://packages.microsoft.com. You can find the respective source code in https://github.com/dotnet. SUSE doesn't provide any support or warranties."
LABEL org.opencontainers.image.version="10.0.0"
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="10.0.0-%RELEASE%"
LABEL org.opensuse.reference="registry.suse.com/bci/dotnet-runtime:10.0.0-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL com.suse.supportlevel="techpreview"
LABEL com.suse.supportlevel.until="2028-11-12"
LABEL com.suse.eula="sle-bci"
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_WITH(README.md)%"


RUN mkdir -p /tmp/

#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-host-10.0.0-1.x86_64.rpm sha256:0367de591ce206589496d4c1489dfaeec748a0cbab2612cd64087de4d92a90dd
COPY dotnet-host-10.0.0-1.x86_64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-host-10.0.0-1.aarch64.rpm sha256:4039fafb70832128c7b3880455e28643ea860a20d0a6ff5c8c26d94080aacd39
COPY dotnet-host-10.0.0-1.aarch64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-hostfxr-10.0-10.0.0-1.x86_64.rpm sha256:6541a4345ba7c0efed58d932c47470a55f906125222c3f634e0f59dee290ded7
COPY dotnet-hostfxr-10.0-10.0.0-1.x86_64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-hostfxr-10.0-10.0.0-1.aarch64.rpm sha256:00ee18289cc2b8a4396cf87a9900cec7b8d86397c09d6d70dcabb8a5ea406a13
COPY dotnet-hostfxr-10.0-10.0.0-1.aarch64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-runtime-deps-10.0-10.0.0-1.x86_64.rpm sha256:987ac9d24088187d2b2bead6e81f0d3f58705db7a104c8326e5077245224ebc6
COPY dotnet-runtime-deps-10.0-10.0.0-1.x86_64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-runtime-deps-10.0-10.0.0-1.aarch64.rpm sha256:1b5bc407a767ecfa7f2817cfa6c060cccba82084371a310977ae9854295fa400
COPY dotnet-runtime-deps-10.0-10.0.0-1.aarch64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-runtime-10.0-10.0.0-1.x86_64.rpm sha256:aa7eb160c0e20dd7a4b2070b962062b7850d1a9c660d51ae5186650cef648bef
COPY dotnet-runtime-10.0-10.0.0-1.x86_64.rpm /tmp/
#!RemoteAssetUrl: https://packages.microsoft.com/sles/15/prod/Packages/d/dotnet-runtime-10.0-10.0.0-1.aarch64.rpm sha256:30db9c1db68222307d46081b91eaab0cf961cf047cc75080417b39bcb42c1eb1
COPY dotnet-runtime-10.0-10.0.0-1.aarch64.rpm /tmp/


# Workaround for https://github.com/openSUSE/obs-build/issues/487
RUN zypper -n install --no-recommends coreutils sles-release

# Importing MS GPG keys
COPY microsoft.asc /tmp
RUN rpm --import /tmp/microsoft.asc

RUN zypper -n install --no-recommends libicu libopenssl1_1
RUN if [ "$(uname -m)" = "aarch64" ]; then zypper -n install /tmp/*aarch64.rpm; elif [ "$(uname -m)" = "x86_64" ]; then zypper -n install /tmp/*x64.rpm /tmp/*x86_64.rpm; fi

COPY prod.repo /etc/zypp/repos.d/microsoft-dotnet-prod.repo
COPY dotnet-host.check /etc/zypp/systemCheck.d/dotnet-host.check

RUN rm -rf /tmp/* && zypper clean -a && rm -rf {/target,}/var/log/{alternatives.log,lastlog,tallylog,zypper.log,zypp/history,YaST2}; \
    rm -rf {/target,}/run/*; \
    rm -f {/target,}/etc/{shadow-,group-,passwd-,.pwd.lock}; \
    rm -f {/target,}/usr/lib/sysimage/rpm/.rpm.lock; \
    rm -f {/target,}/var/cache/ldconfig/aux-cache; \
    command -v zypper >/dev/null 2>&1 || rm -f /var/lib/zypp/AutoInstalled



ENV APP_UID=1654 ASPNETCORE_HTTP_PORTS=8080 DOTNET_RUNNING_IN_CONTAINER=true
ENV DOTNET_VERSION=10.0.0
RUN useradd --uid=$APP_UID -U -d /app -G '' -ms /bin/bash app
WORKDIR /app
EXPOSE 8080
