Skip to content

Commit

Permalink
fix: csharp extension usage of dotnet 8 (#269)
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem authored Jun 7, 2024
2 parents 4623ded + 264c6c3 commit b3ffd92
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 61 deletions.
50 changes: 7 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,39 +64,13 @@ jobs:
run: |
find /tmp/packages -name 'ArmoniK*.nupkg' ! -name '*test*.nupkg' -exec dotnet nuget push {} -k ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols \;
buildWorkerEnd2End:
buildImages:
runs-on: ubuntu-latest
needs:
- versionning
env:
VERSION: ${{ needs.versionning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
submodules: true

- name: login
run: |
echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_LOGIN }} --password-stdin
- name: build
run: |
docker build -t dockerhubaneo/armonik_worker_dll:$VERSION -f Worker/src/DLLWorker/Dockerfile .
- name: push
run: |
docker push dockerhubaneo/armonik_worker_dll:$VERSION
buildImagesCross:
runs-on: ubuntu-latest
needs:
- versionning
- buildWorkerEnd2End
env:
VERSION: ${{ needs.versionning.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -107,7 +81,7 @@ jobs:

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3

- name: login
uses: docker/login-action@v2
Expand All @@ -119,23 +93,13 @@ jobs:
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Build and push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4
with:
file: Worker/src/DLLWorker/Dockerfile
context: .
platforms: linux/arm64
push: true
tags: |
dockerhubaneo/armonik_worker_dll:${{ needs.versionning.outputs.version }}-arm
- name: Create multi-arch manifest
run: docker buildx imagetools create dockerhubaneo/armonik_worker_dll:${VERSION} --tag dockerhubaneo/armonik_worker_dll:${VERSION} --append dockerhubaneo/armonik_worker_dll:${VERSION}-arm

run: docker buildx build --progress=plain --platform=linux/amd64,linux/arm64 --push=true -t dockerhubaneo/armonik_worker_dll:${VERSION} -f Worker/src/DLLWorker/Dockerfile ./

testEndToEnd:
needs:
- versionning
- buildProjects
- buildWorkerEnd2End
- buildImages
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -264,7 +228,7 @@ jobs:
runs-on: ubuntu-latest
needs:
- versionning
- buildWorkerEnd2End
- buildImages
env:
VERSION: ${{ needs.versionning.outputs.version }}
steps:
Expand All @@ -289,7 +253,7 @@ jobs:

- name: Build Docker image
run: |
docker build -t test_image:latest --build-arg WORKER_DLL_IMAGE=dockerhubaneo/armonik_worker_dll:$VERSION -f Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile .
docker buildx build --tag test_image:latest --platform=linux/amd64 --build-arg WORKER_DLL_IMAGE=dockerhubaneo/armonik_worker_dll:$VERSION -f Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile --load .
docker save "test_image:latest" | sudo k3s ctr images import /dev/stdin
- name: Change version
run: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG WORKER_DLL_IMAGE=dockerhubaneo/armonik_worker_dll:0.14.5

FROM mcr.microsoft.com/dotnet/sdk:8.0-bookworm-slim AS build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY . .


WORKDIR "/src/Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker"

RUN dotnet publish --self-contained -c Release -r linux-x64 -f net8.0 .
RUN dotnet publish -a "${TARGETARCH}" --self-contained -c Release -f net8.0 .


FROM ${WORKER_DLL_IMAGE} AS final
Expand Down
17 changes: 3 additions & 14 deletions Worker/src/DLLWorker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
ARG TARGETARCH

Expand All @@ -11,25 +11,14 @@ COPY ["Worker/src/DLLWorker/ArmoniK.DevelopmentKit.Worker.DLLWorker.csproj", "Wo
COPY ["Common/src/Common/ArmoniK.DevelopmentKit.Common.csproj", "Common/src/Common/"]
COPY ["Client/src/Common/ArmoniK.DevelopmentKit.Client.Common.csproj", "Client/src/Common/"]
COPY ["Worker/src/Common/ArmoniK.DevelopmentKit.Worker.Common.csproj", "Worker/src/Common/"]
RUN dotnet restore "Worker/src/DLLWorker/ArmoniK.DevelopmentKit.Worker.DLLWorker.csproj"
RUN dotnet restore -a "${TARGETARCH}" "Worker/src/DLLWorker/ArmoniK.DevelopmentKit.Worker.DLLWorker.csproj"
COPY . .
WORKDIR "/src/Worker/src/DLLWorker"
ARG BUILD_CONFIG=Release
RUN dotnet build "ArmoniK.DevelopmentKit.Worker.DLLWorker.csproj" -c "${BUILD_CONFIG}" -f net8.0 -o /app/build

FROM build AS publish
ARG BUILD_CONFIG=Release
RUN case "$TARGETARCH" in \
amd64) DOTNET_ARCH=linux-x64 ;; \
arm64) DOTNET_ARCH=linux-arm64 ;; \
"") case "$(uname -m)" in \
x86_64) DOTNET_ARCH=linux-x64 ;; \
aarch64) DOTNET_ARCH=linux-arm64 ;; \
*) exit 1 ;; \
esac ;; \
*) exit 1 ;; \
esac ; \
dotnet publish "ArmoniK.DevelopmentKit.Worker.DLLWorker.csproj" -c "${BUILD_CONFIG}" -f net8.0 -o /app/publish -r "${DOTNET_ARCH}" --self-contained true
RUN dotnet publish -a "${TARGETARCH}" "ArmoniK.DevelopmentKit.Worker.DLLWorker.csproj" -c "${BUILD_CONFIG}" -f net8.0 -o /app/publish --self-contained true

FROM base AS final

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0</TargetFrameworks>
<OutputType>Library</OutputType>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<IsPackable>true</IsPackable>
Expand Down

0 comments on commit b3ffd92

Please sign in to comment.