Initial checkin

This commit is contained in:
2023-11-22 15:19:43 -05:00
parent 3752c97a8c
commit 80b4ce1ad8
16 changed files with 425 additions and 0 deletions

29
Dockerfile Normal file
View File

@@ -0,0 +1,29 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG TARGETARCH
WORKDIR /source
# copy csproj and restore as distinct layers
#COPY *.csproj .
#RUN dotnet restore -a $TARGETARCH
#RUN dotnet restore -r linux-$TARGETARCH
# copy and publish app and libraries
COPY . .
#RUN dotnet publish TodoApi.csproj -c Release -a $TARGETARCH --self-contained false --no-restore -o /app
RUN dotnet publish TodoApi.csproj -r linux-$TARGETARCH --self-contained false -o /app
# Build database migration tool
RUN dotnet tool install --global dotnet-ef --version 8.0.0
ENV PATH="${PATH}:/root/.dotnet/tools"
RUN dotnet ef migrations bundle --self-contained -r linux-$TARGETARCH -o /app/migratedb
#RUN dotnet ef migrations bundle --no-build -o /app/migratedb --verbose
# final stage/image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app .
EXPOSE 8080
ENV DOTNET_EnableDiagnostics=0
ENTRYPOINT ["./TodoApi"]