Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cartservice] Update to .NET8 #1272

Merged
merged 3 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,64 +38,83 @@ 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
# OTP/Elixir versions. Please do not change the OTP/Elixir versions.
- 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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/cartservice/src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand All @@ -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/ ./
Expand Down
8 changes: 4 additions & 4 deletions src/cartservice/src/cartservice.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<StaticWebAssetsEnabled>false</StaticWebAssetsEnabled>
</PropertyGroup>
Expand All @@ -11,9 +11,9 @@
<PackageReference Include="Grpc.AspNetCore.HealthChecks" Version="2.59.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.6.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.5.1-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.6.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.3" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.0.0-rc9.12" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.5.1" />
Expand Down
8 changes: 4 additions & 4 deletions src/cartservice/tests/cartservice.tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.59.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.13" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Loading