Skip to content

Commit

Permalink
Switch to building framework-dependent docker image, avoids crosscomp…
Browse files Browse the repository at this point in the history
…iling (#16)
  • Loading branch information
jiridanek authored Jun 19, 2023
1 parent ea5023d commit ecc73a9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/image_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
# 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|<TargetFramework>net6.0</TargetFramework>|<TargetFramework>net7.0</TargetFramework>|' {} \;

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 <image_name:tag> /bin/bash cli-proton-dotnet-*"

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
Expand Down
2 changes: 1 addition & 1 deletion image/cli-proton-dotnet-connector
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

/opt/cli-proton-dotnet/Connector "$@"
dotnet /opt/cli-proton-dotnet/Connector.dll "$@"
2 changes: 1 addition & 1 deletion image/cli-proton-dotnet-receiver
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

/opt/cli-proton-dotnet/Receiver "$@"
dotnet /opt/cli-proton-dotnet/Receiver.dll "$@"
2 changes: 1 addition & 1 deletion image/cli-proton-dotnet-sender
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

/opt/cli-proton-dotnet/Sender "$@"
dotnet /opt/cli-proton-dotnet/Sender.dll "$@"

0 comments on commit ecc73a9

Please sign in to comment.