Created
February 26, 2024 16:38
-
-
Save csharpfritz/396c5581efd551b1217b11e51f6d5a53 to your computer and use it in GitHub Desktop.
Dockerfile for Raspberry Pi 3b sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-preview-alpine AS build | |
ARG TARGETARCH | |
WORKDIR /source | |
# copy csproj and restore as distinct layers | |
COPY Fritz.DemoPi/*.csproj . | |
RUN dotnet restore -a $TARGETARCH | |
# copy everything else and build app | |
COPY Fritz.DemoPi/. . | |
COPY .git/. .git/. | |
RUN dotnet publish -a $TARGETARCH --no-restore -o /app | |
# final stage/image | |
# .NET 8 tag includes `-preview` | |
FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview-alpine | |
# These ENVs are only needed because the sample uses .NET 7 | |
ENV DOTNET_ROLL_FORWARD=Major | |
ENV DOTNET_ROLL_FORWARD_PRE_RELEASE=1 | |
WORKDIR /app | |
COPY --from=build /app . | |
USER $APP_UID | |
ENTRYPOINT ["./Fritz.DemoPi"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment