From b61a93549df19cfe7d62bf464ca9a5901ec2676e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Kie=C5=82kowicz?= Date: Sat, 9 Dec 2023 23:28:29 +0100 Subject: [PATCH] [cartservice] Update to .NET8 (#1272) * [cartservice] Update to .NET8 * Do not install QEMU for .NET * Use BUILDPLATFORM/TARGETARCH --- .github/workflows/build-images.yml | 20 +++++++++++++++++++ CHANGELOG.md | 2 ++ src/cartservice/src/Dockerfile | 9 +++++---- src/cartservice/src/cartservice.csproj | 8 ++++---- .../tests/cartservice.tests.csproj | 8 ++++---- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 0bcb306c20..b4b09d4197 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -38,18 +38,23 @@ jobs: - file: ./src/adservice/Dockerfile tag_suffix: adservice context: ./ + setup-qemu: true - file: ./src/cartservice/src/Dockerfile tag_suffix: cartservice context: ./ + setup-qemu: false - file: ./src/checkoutservice/Dockerfile tag_suffix: checkoutservice context: ./ + setup-qemu: true - file: ./src/currencyservice/Dockerfile tag_suffix: currencyservice context: ./src/currencyservice + setup-qemu: true - file: ./src/emailservice/Dockerfile tag_suffix: emailservice context: ./src/emailservice + setup-qemu: true # NOTE: # https://github.com/open-telemetry/opentelemetry-demo/issues/956 # Until dedicated ARM runners are available for GHA we cannot upgrade @@ -57,45 +62,59 @@ jobs: - file: ./src/featureflagservice/Dockerfile tag_suffix: featureflagservice context: ./ + setup-qemu: true - file: ./src/frontend/Dockerfile tag_suffix: frontend context: ./ + setup-qemu: true - file: ./src/frontendproxy/Dockerfile tag_suffix: frontendproxy context: ./ + setup-qemu: true - file: ./src/loadgenerator/Dockerfile tag_suffix: loadgenerator context: ./ + setup-qemu: true - file: ./src/paymentservice/Dockerfile tag_suffix: paymentservice context: ./ + setup-qemu: true - file: ./src/productcatalogservice/Dockerfile tag_suffix: productcatalogservice context: ./ + setup-qemu: true - file: ./src/quoteservice/Dockerfile tag_suffix: quoteservice context: ./ + setup-qemu: true - file: ./src/shippingservice/Dockerfile tag_suffix: shippingservice context: ./ + setup-qemu: true - file: ./src/recommendationservice/Dockerfile tag_suffix: recommendationservice context: ./ + setup-qemu: true - file: ./src/kafka/Dockerfile tag_suffix: kafka context: ./ + setup-qemu: true - file: ./src/accountingservice/Dockerfile tag_suffix: accountingservice context: ./ + setup-qemu: true - file: ./src/frauddetectionservice/Dockerfile tag_suffix: frauddetectionservice context: ./ + setup-qemu: true - file: ./src/frontend/Dockerfile.cypress tag_suffix: frontend-tests context: ./ + setup-qemu: true - file: ./test/Dockerfile tag_suffix: integrationTests context: ./ + setup-qemu: true steps: - uses: actions/checkout@v4 @@ -131,6 +150,7 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} if: ${{ inputs.push }} - name: Set up QEMU + if: ${{ matrix.file_tag.setup-qemu }} uses: docker/setup-qemu-action@v3 with: image: tonistiigi/binfmt:master diff --git a/CHANGELOG.md b/CHANGELOG.md index e7e2ef4d47..477745fba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ release. ([#1239](https://github.com/open-telemetry/opentelemetry-demo/pull/1239)) * [cartservice] Add .NET memory, CPU, and thread metrics ([#1265](https://github.com/open-telemetry/opentelemetry-demo/pull/1265)) +* [cartservice] update .NET to .NET 8.0 + ([#1272](https://github.com/open-telemetry/opentelemetry-demo/pull/1272)) * enable browser traffic in loadgenerator using playwright ([#1266](https://github.com/open-telemetry/opentelemetry-demo/pull/1266)) * update loadgenerator dependencies and the base image diff --git a/src/cartservice/src/Dockerfile b/src/cartservice/src/Dockerfile index 38c39366dc..7b7d534311 100644 --- a/src/cartservice/src/Dockerfile +++ b/src/cartservice/src/Dockerfile @@ -15,7 +15,8 @@ # limitations under the License. # https://mcr.microsoft.com/v2/dotnet/sdk/tags/list -FROM mcr.microsoft.com/dotnet/sdk:7.0.403 AS builder +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0.100-1 AS builder +ARG TARGETARCH WORKDIR /usr/src/app/ @@ -24,18 +25,18 @@ COPY ./pb/ ./src/protos/ RUN \ RUNTIME_IDENTIIFER=linux-musl-x64; \ - if [ "$(uname -m)" = "aarch64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ + if [ "${TARGETARCH}" = "arm64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ dotnet restore ./src/cartservice.csproj -v d -r $RUNTIME_IDENTIIFER RUN \ RUNTIME_IDENTIIFER=linux-musl-x64; \ - if [ "$(uname -m)" = "aarch64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ + if [ "${TARGETARCH}" = "arm64" ]; then RUNTIME_IDENTIIFER=linux-musl-arm64; fi; \ dotnet publish ./src/cartservice.csproj -v d -p:PublishSingleFile=true -r $RUNTIME_IDENTIIFER --self-contained true -p:PublishTrimmed=False -p:TrimMode=Link -c Release -o /cartservice --no-restore # ----------------------------------------------------------------------------- # https://mcr.microsoft.com/v2/dotnet/runtime-deps/tags/list -FROM mcr.microsoft.com/dotnet/runtime-deps:7.0.4-alpine3.16 +FROM mcr.microsoft.com/dotnet/runtime-deps:8.0.0-alpine3.18 WORKDIR /usr/src/app/ COPY --from=builder /cartservice/ ./ diff --git a/src/cartservice/src/cartservice.csproj b/src/cartservice/src/cartservice.csproj index 0274442663..799010ec16 100644 --- a/src/cartservice/src/cartservice.csproj +++ b/src/cartservice/src/cartservice.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false false @@ -11,9 +11,9 @@ - - - + + + diff --git a/src/cartservice/tests/cartservice.tests.csproj b/src/cartservice/tests/cartservice.tests.csproj index 53f364e5a8..861ff2237d 100644 --- a/src/cartservice/tests/cartservice.tests.csproj +++ b/src/cartservice/tests/cartservice.tests.csproj @@ -1,15 +1,15 @@ - net6.0 + net8.0 - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive