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

Qemu in Github Action Workflow with arm64 platform #69

Open
1fini opened this issue Feb 17, 2023 · 4 comments
Open

Qemu in Github Action Workflow with arm64 platform #69

1fini opened this issue Feb 17, 2023 · 4 comments
Labels

Comments

@1fini
Copy link

1fini commented Feb 17, 2023

Behaviour

[linux/arm64 publish 1/1] RUN dotnet publish "Automate.csproj" -c Release -o /app/publish:

/usr/share/dotnet/sdk/7.0.103/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.Shared.targets(201,5): error MSB4063: The "CheckForDuplicateItems" task could not be initialized with its input parameters. [/src/Automate/Automate.csproj]

Steps to reproduce this issue

  1. Dockerfile with net7 app
  2. Qemu to build image for platform arm64 on GitHub Actions
name: Docker Image CI

on:
  push:
    branches: [ main ]
    tags:
      - 'v*'

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - name: Checkout code
      uses: actions/checkout@v2

    - name: Login to DockerHub
      uses: docker/login-action@v1
      with:
        username: ${{ secrets.DOCKER_USERNAME }}
        password: ${{ secrets.DOCKERHUB_PASSWORD }}
        
    - name: Set up QEMU
      uses: docker/setup-qemu-action@v2
      with:
        platforms: all
        
    - name: Set up Docker Buildx
      id: docker_buildx
      uses: docker/setup-buildx-action@v1
        
    - name: Build and push amd64 & arm64
      uses: docker/build-push-action@v2
      with:
        builder: ${{ steps.docker_buildx.outputs.name}}
        context: .
        file: ./Automate/Dockerfile
        push: true
        platforms: linux/amd64, linux/arm64
        tags: ${{ steps.meta.outputs.tags }}
        labels: ${{ steps.meta.outputs.labels }}

Dockerfile

FROM mcr.microsoft.com/dotnet/runtime:7.0-jammy AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:7.0-jammy AS build
WORKDIR /src
COPY ["Automate/Automate.csproj", "Automate/"]
COPY ["Automate.Domain/Automate.Domain.csproj", "Automate.Domain/"]
COPY ["Automate.Infrastructure/Automate.Infrastructure.csproj", "Automate.Infrastructure/"]
RUN dotnet restore "Automate/Automate.csproj"
COPY . .
WORKDIR "/src/Automate"
RUN dotnet build "Automate.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Automate.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Automate.dll"]

Logs

first paragraph

Regards

@crazy-max
Copy link
Member

Can you post a basic Dockerfile for repro please?

@1fini
Copy link
Author

1fini commented Feb 17, 2023

Can you post a basic Dockerfile for repro please?

Thank you @crazy-max for your comment and help. I updated my initial post with my dockerfile which is almost the same as the template provided by VS2022 at project creation time.

@KempMVitesse
Copy link

@1fini We've been seeing this issue, we fixed it by putting DOTNET_EnableWriteXorExecute=0 in front of every dotnet call.

RUN DOTNET_EnableWriteXorExecute=0 dotnet build "myproject.csproj" -c Release -o /app/build

It still doesn't resolve issues with multi-platform and especially arm64 builds running horrifically slow on the default github actions runners.

@darena-patrick
Copy link

did anyone figure this out? I added the DOTNET_EnableWriteXorExecute=0 and it took 30m to build vs the normal 3m or so - BUT with no errors! Any updates would be greatly appreciated! 30m on a GitHub runner adds up over time 😄

@crazy-max crazy-max added the qemu label Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants