Skip to content

Commit 92304ac

Browse files
Support multiple architectures in Dockerfile (#277)
* Support multiple architectures in Dockerfile * Add missing package
1 parent 4b9d2fd commit 92304ac

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:8.0.201-alpine3.19-amd64 AS build
1+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
ARG TARGETARCH
23

34
WORKDIR /tmp
45

@@ -20,25 +21,29 @@ RUN dotnet add package FsCheck.Xunit -v 2.14.3
2021
RUN dotnet add package FSharp.Core -v 6.0.1
2122
RUN dotnet add package FSharp.Core -v 7.0.400
2223
RUN dotnet add package FSharp.Core -v 8.0.101
24+
RUN dotnet add package FSharp.Core -v 8.0.403
2325
RUN dotnet add package FParsec -v 1.1.1
2426
RUN dotnet add package FsToolkit.ErrorHandling -v 4.15.2
2527

2628
WORKDIR /app
2729

2830
# Copy fsproj and restore as distinct layers
2931
COPY src/Exercism.TestRunner.FSharp/Exercism.TestRunner.FSharp.fsproj ./
30-
RUN dotnet restore -r linux-musl-x64
32+
RUN dotnet restore -a $TARGETARCH
3133

3234
# Copy everything else and build
3335
COPY src/Exercism.TestRunner.FSharp/ ./
34-
RUN dotnet publish -r linux-musl-x64 -c Release -o /opt/test-runner --no-restore
36+
RUN dotnet publish -a $TARGETARCH -c Release -o /opt/test-runner --no-restore
3537

3638
# Build runtime image
37-
FROM mcr.microsoft.com/dotnet/sdk:8.0.201-alpine3.19-amd64 AS runtime
38-
WORKDIR /opt/test-runner
39+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS runtime
3940

40-
# Enable rolling forward the .NET SDK used to be backwards-compatible
41+
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
4142
ENV DOTNET_ROLL_FORWARD=Major
43+
ENV DOTNET_NOLOGO=true
44+
ENV DOTNET_CLI_TELEMETRY_OPTOUT=true
45+
46+
WORKDIR /opt/test-runner
4247

4348
COPY --from=build /root/.nuget/packages/ /root/.nuget/packages/
4449
COPY --from=build /opt/test-runner/ .

0 commit comments

Comments
 (0)