-
-
Notifications
You must be signed in to change notification settings - Fork 81
Description
Thank you for a great product... and fabulous documentation!
I can't wait to use it!
Attempting to build on OSX and on a Raspberry Pi 4 - plenty of docker, K8s, UNIX, and C/C++ experience, but little with .NET.
Environment for OSX
OSX Sequoia 15.2
Docker 27.4.0
The .env file has an ACCESS_TOKEN set with the OpenLDBWS token
Output of dotnet --info
.NET SDK:
Version: 8.0.405
Commit: fb1830d421
Workload version: 8.0.400-manifests.c7afa696
MSBuild version: 17.11.9+a69bbaaf5
Runtime Environment:
OS Name: Mac OS X
OS Version: 15.2
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/8.0.405/
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.
Host:
Version: 8.0.12
Architecture: arm64
Commit: 89ef51c5d8
.NET SDKs installed:
8.0.405 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
x64 [/usr/local/share/dotnet/x64]
registered at [/etc/dotnet/install_location_x64]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Steps to reproduce RID configuration in build
Initially the build complained
=> ERROR [huxley2 build-env 4/6] RUN dotnet restore --runtime alpine-x64
According to .NET SDK uses a smaller RID graph alpine-x64 is deprecated
To remedy I followed the recommended action and added this to the PropertyGroup in Huxley2.csproj
<UseRidGraph>true</UseRidGraph>
I ran docker builder prune --all to ensure a clean build.
Steps to reproduce PublishTrimmed issue
docker compose up runs and terminates with the following error message (there are many Warnings - adding the last Warning prior to the fatal error):
4.078 /app/Services/DelaysService.cs(119,81): warning CA1303: Method 'Task<DelaysResponse> DelaysService.GetDelaysAsync(StationBoardRequest request)' passes a literal string as parameter 'message' of a call to 'ArgumentOutOfRangeException.ArgumentOutOfRangeException(string? paramName, string? message)'. Retrieve the following string(s) from a resource table inst[+] Running 0/1ilterType". (https://docs.microsoft.com/visualstudio/code-quality/ca1303-do-not-pass-literals-as-localized-parameters) [/app/Huxley2.csproj]
⠧ Service huxley2 Building 4.7s
failed to solve: process "/bin/sh -c dotnet publish -c Release -o out --no-restore --runtime alpine-x64 --self-contained true /p:PublishTrimmed=true /p:PublishSingleFile=true" did not complete successfully: exit code: 1
To remedy this I had to set PublishTrimmed=false in the Dockerfile
I now get a build and deploy.
Note - I had to change the build to arm64 for cater for OSX/Pi architecture
Sharing in case it's worth putting in a note for others who may want to build on ARM (or see this error).
WARN[0000] The "STAFF_ACCESS_TOKEN" variable is not set. Defaulting to a blank string.
WARN[0000] The "CLIENT_ACCESS_TOKEN" variable is not set. Defaulting to a blank string.
WARN[0000] /Users/JonMS/Documents/jonms-Huxley2/Huxley2/docker-compose.yml: the attribute `version` is obsolete, it will be ignored, please remove it to avoid potential confusion
[+] Running 1/0
Container huxley2-huxley2-1 Created 0.0s
Attaching to huxley2-1
huxley2-1 | rosetta error: failed to open elf at /lib/ld-musl-x86_64.so.1
huxley2-1 |
huxley2-1 exited with code 133
This was remedied with a change to the Dockerfile:
RUN dotnet restore --runtime alpine-arm64
and
RUN dotnet publish -c Release -o out \
--no-restore \
-- runtime alpine-arm64 \
--self-contained true \
/p:PublishTrimmed=false \
/p:PublishSingleFile=true