diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e68eda45..2847ffe1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: @@ -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 @@ -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: @@ -264,7 +228,7 @@ jobs: runs-on: ubuntu-latest needs: - versionning - - buildWorkerEnd2End + - buildImages env: VERSION: ${{ needs.versionning.outputs.version }} steps: @@ -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: | diff --git a/Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile b/Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile index f62d9088..48532282 100644 --- a/Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile +++ b/Tests/ArmoniK.EndToEndTests/ArmoniK.EndToEndTests.Worker/Dockerfile @@ -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 diff --git a/Worker/src/DLLWorker/Dockerfile b/Worker/src/DLLWorker/Dockerfile index 6c35b33b..a7a81896 100644 --- a/Worker/src/DLLWorker/Dockerfile +++ b/Worker/src/DLLWorker/Dockerfile @@ -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 @@ -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 diff --git a/Worker/src/Symphony/ArmoniK.DevelopmentKit.Worker.Symphony.csproj b/Worker/src/Symphony/ArmoniK.DevelopmentKit.Worker.Symphony.csproj index 614d18b9..bf8135dc 100644 --- a/Worker/src/Symphony/ArmoniK.DevelopmentKit.Worker.Symphony.csproj +++ b/Worker/src/Symphony/ArmoniK.DevelopmentKit.Worker.Symphony.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 Library True true diff --git a/Worker/src/Unified/ArmoniK.DevelopmentKit.Worker.Unified.csproj b/Worker/src/Unified/ArmoniK.DevelopmentKit.Worker.Unified.csproj index 6210bf83..a055e98d 100644 --- a/Worker/src/Unified/ArmoniK.DevelopmentKit.Worker.Unified.csproj +++ b/Worker/src/Unified/ArmoniK.DevelopmentKit.Worker.Unified.csproj @@ -1,7 +1,7 @@ - net6.0;net8.0 + net8.0 Library True true