Skip to content
Open
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
7 changes: 4 additions & 3 deletions StandAlone.NETCoreApp.Local/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env

@StefH StefH Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please keep the Docker file as-is.
And create a new yml + Docker file which uses this new logic to build these special ARM versions?

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG TARGETARCH

LABEL maintainer="Stef Heyenrath"

WORKDIR /app

# copy csproj and restore as distinct layers
COPY StandAlone.NETCoreApp.csproj ./
RUN dotnet restore
RUN dotnet restore -a $TARGETARCH

# copy everything else and build
COPY *.cs ./
RUN dotnet publish -c Release -r linux-x64 -o out
RUN dotnet publish -c Release -a $TARGETARCH -o out --no-restore

# build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
Expand Down
7 changes: 4 additions & 3 deletions StandAlone.NETCoreApp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
ARG TARGETARCH

LABEL maintainer="Stef Heyenrath"

WORKDIR /app

# copy csproj and restore as distinct layers
COPY StandAlone.NETCoreApp.csproj ./
RUN dotnet restore
RUN dotnet restore -a $TARGETARCH

# copy everything else and build
COPY *.cs ./
RUN dotnet publish -c Release -r linux-x64 -o out
RUN dotnet publish -c Release -a $TARGETARCH -o out --no-restore

# build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
Expand Down
50 changes: 19 additions & 31 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,27 @@ variables:
trigger: none

pool:
vmImage: 'Ubuntu-latest'
vmImage: 'ubuntu-latest'

steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: 8.0.x

- task: DotNetCoreCLI@2
displayName: Build StandAlone.NETCoreApp
inputs:
command: 'build'
arguments: /p:Configuration=$(buildConfiguration)
projects: $(buildProjects)

- task: Docker@2
displayName: 'Build Docker [$(imageName)(latest,$(tag)]'
displayName: Login to registry
inputs:
command: 'build'
containerRegistry: 'DockerRegistry'
repository: '$(DOCKER_ID)/$(imageName)'
dockerfile: '$(Build.SourcesDirectory)/StandAlone.NETCoreApp/Dockerfile'
tags: |
$(tag)
latest
command: login
containerRegistry: DockerRegistry

- task: Docker@2
displayName: 'Push Docker [$(imageName)(latest,$(tag)]'
inputs:
command: 'push'
containerRegistry: 'DockerRegistry'
repository: '$(DOCKER_ID)/$(imageName)'
dockerfile: '$(Build.SourcesDirectory)/StandAlone.NETCoreApp/Dockerfile'
tags: |
$(tag)
latest
- script: |
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --use --name builder
docker buildx inspect --bootstrap
displayName: Set up Docker buildx

- script: |
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
--tag $(DOCKER_ID)/$(imageName):$(tag) \
--tag $(DOCKER_ID)/$(imageName):latest \
--file $(Build.SourcesDirectory)/StandAlone.NETCoreApp/Dockerfile \
$(Build.SourcesDirectory)/StandAlone.NETCoreApp \
--push
displayName: 'Build multi-arch Docker image [$(imageName)(latest,$(tag)]'