Skip to content

Commit

Permalink
Set restore to be platform specific
Browse files Browse the repository at this point in the history
  • Loading branch information
GinoCanessa committed Aug 30, 2024
1 parent 1700b9f commit 67836f1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app

# Copy everything else and build
COPY . ./

# Build with platform-specific .Net RID
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
dotnet restore src/fhir-candle/fhir-candle.csproj --arch linux-x64; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0 --arch linux-x64; \
elif [ "$TARGETPLATFORM" = "linux/arm64" ]; then \
dotnet restore src/fhir-candle/fhir-candle.csproj --arch linux-arm64; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0 --arch linux-arm64; \
elif [ "$TARGETPLATFORM" = "windows/x64" ]; then \
dotnet restore src/fhir-candle/fhir-candle.csproj --arch win-x64; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0 --arch win-x64; \
elif [ "$TARGETPLATFORM" = "windows/arm64" ]; then \
dotnet restore src/fhir-candle/fhir-candle.csproj --arch win-arm64; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0 --arch win-arm64; \
elif [ "$TARGETPLATFORM" = "darwin/x64" ]; then \
dotnet restore src/fhir-candle/fhir-candle.csproj --arch osx-x64; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0 --arch osx-x64; \
elif [ "$TARGETPLATFORM" = "darwin/arm64" ]; then \
dotnet restore src/fhir-candle/fhir-candle.csproj --arch osx-arm64; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0 --arch osx-arm64; \
else \
dotnet restore src/fhir-candle/fhir-candle.csproj --framework net8.0; \
dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0; \
fi;

#RUN dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out --framework net8.0;
#RUN dotnet publish src/fhir-candle/fhir-candle.csproj -c Release -o out

# Build runtime image
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "fhir-candle.dll"]
Expand Down

0 comments on commit 67836f1

Please sign in to comment.