Long Build Time for dotnet app

Hello, I am trying to build a Docker image based off of retype.

In this documentation, there is an example of a Dockerfile that will build a Docker image that can then be deployed on cloud providers.

However, I am on an arm64 machine which means that when I build it, the Docker image is ARM64. I am trying to deploy this on DigitalOcean through App Service but get the error:

[2025-02-12 18:17:16] starting container: starting sub-container [httpd-foreground]: creating process: failed to load /usr/local/bin/httpd-foreground: exec format error

I believe this is because the format is not correct and I need an amd64 image. However, when I try to build it with: docker build --platform=linux/amd64 -t retype:docs . - the build is taking way too long:

Here is the Dockerile:

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS builder
WORKDIR /build

# Pre-install dependencies first to leverage Docker's build cache
RUN dotnet nuget locals all --clear
RUN dotnet tool install retypeapp --tool-path /bin

COPY . /build
RUN retype build --output .docker-build/

FROM httpd:latest
COPY --from=builder /build/.docker-build/ /usr/local/apache2/htdocs/

If a build is created for another platform, it will leverage qemu for the emulation of the cpu architecture of the target platform. Emulating amd64 on an arm64 architecture cpu is expected to be slow.

Oh okay. So, the 350s that I am seeing so far is not abnormal?

@meyay I added --platform=$BUILDPLATFORM after FROM in the first line and now it’s building in 3.3 seconds.

Interesting. I would not have expected different results,

Thank you for sharing it!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.