From ecc73a988ef7706e1c3e148a959e0198cd6f1ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Mon, 19 Jun 2023 20:14:36 +0200 Subject: [PATCH] Switch to building framework-dependent docker image, avoids crosscompiling (#16) --- .github/workflows/image_build.yaml | 3 ++- Dockerfile | 17 +++++++++++------ image/cli-proton-dotnet-connector | 2 +- image/cli-proton-dotnet-receiver | 2 +- image/cli-proton-dotnet-sender | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/image_build.yaml b/.github/workflows/image_build.yaml index d1be12b..3505fa7 100644 --- a/.github/workflows/image_build.yaml +++ b/.github/workflows/image_build.yaml @@ -35,7 +35,8 @@ jobs: with: image: ${{ env.IMAGE_NAME }} tags: latest ${{ github.sha }} ${{ steps.cleaned_ref_name.outputs.ref_name }} - archs: amd64, arm64, s390x + # consider skipping arm64 because of https://github.com/dotnet/sdk/issues/29892 + archs: amd64, arm64, ppc64le, s390x containerfiles: | ./Dockerfile diff --git a/Dockerfile b/Dockerfile index 697a298..c127685 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,29 @@ # Arguments for DEV's (comment static FROM and uncomnnet #DEV ones) ARG UBI_VERSION=8 -ARG DOTNET_VERSION=60 +ARG DOTNET_VERSION=70 ARG UBI_BUILD_TAG=latest ARG UBI_RUNTIME_TAG=latest ARG IMAGE_BUILD=registry.access.redhat.com/ubi${UBI_VERSION}/dotnet-${DOTNET_VERSION}:${UBI_TAG} ARG IMAGE_BASE=registry.access.redhat.com/ubi${UBI_VERSION}/dotnet-${DOTNET_VERSION}-runtime:${UBI_RUNTIME_TAG} #DEV FROM $IMAGE_BUILD AS build -FROM registry.access.redhat.com/ubi8/dotnet-60:6.0-29 AS build +FROM --platform=$BUILDPLATFORM registry.access.redhat.com/ubi8/dotnet-70@sha256:de739e02366216892e0e12b391acaab39542c65902e89a53a119eff7d21ca3c5 AS build USER root COPY . /src WORKDIR /src -RUN dotnet publish -c Release -o /publish +# https://community.ibm.com/community/user/powerdeveloper/blogs/alhad-deshpande/2023/01/13/identityserver-sqlite-db-on-net-7 +RUN microdnf install -y findutils sed +RUN find -name '*.csproj' -exec sed -i 's|net6.0|net7.0|' {} \; + +RUN dotnet build -c Release +RUN dotnet publish --no-build --self-contained false -c Release -o /publish RUN echo "package info:("$(dotnet list cli-proton-dotnet.sln package)")" >> /publish/VERSION.txt #DEV FROM $IMAGE_BASE -FROM registry.access.redhat.com/ubi8/dotnet-60-runtime:6.0-29 +FROM --platform=$TARGETPLATFORM registry.access.redhat.com/ubi8/dotnet-70-runtime:7.0-14 LABEL name="Red Hat Messaging QE - Proton Dotnet CLI Image" \ run="podman run --rm -ti /bin/bash cli-proton-dotnet-*" @@ -26,9 +31,9 @@ LABEL name="Red Hat Messaging QE - Proton Dotnet CLI Image" \ USER root # install fallocate for use by claire tests -RUN dnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install \ +RUN microdnf -y --setopt=install_weak_deps=0 --setopt=tsflags=nodocs install \ util-linux \ - && dnf clean all -y + && microdnf clean all -y RUN mkdir /licenses COPY ./LICENSE /licenses/LICENSE.txt diff --git a/image/cli-proton-dotnet-connector b/image/cli-proton-dotnet-connector index c336186..75bfd9f 100644 --- a/image/cli-proton-dotnet-connector +++ b/image/cli-proton-dotnet-connector @@ -1,3 +1,3 @@ #!/bin/sh -/opt/cli-proton-dotnet/Connector "$@" +dotnet /opt/cli-proton-dotnet/Connector.dll "$@" diff --git a/image/cli-proton-dotnet-receiver b/image/cli-proton-dotnet-receiver index 93d28d0..74204db 100644 --- a/image/cli-proton-dotnet-receiver +++ b/image/cli-proton-dotnet-receiver @@ -1,3 +1,3 @@ #!/bin/sh -/opt/cli-proton-dotnet/Receiver "$@" +dotnet /opt/cli-proton-dotnet/Receiver.dll "$@" diff --git a/image/cli-proton-dotnet-sender b/image/cli-proton-dotnet-sender index 6855e5f..1fead17 100644 --- a/image/cli-proton-dotnet-sender +++ b/image/cli-proton-dotnet-sender @@ -1,3 +1,3 @@ #!/bin/sh -/opt/cli-proton-dotnet/Sender "$@" +dotnet /opt/cli-proton-dotnet/Sender.dll "$@"