Last active
May 29, 2022 23:06
-
-
Save Andersoft/f450a90265bca51055b57b6ce21c2ae5 to your computer and use it in GitHub Desktop.
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 mcr.microsoft.com/dotnet/sdk:6.0 AS base | |
WORKDIR /app | |
ARG project | |
COPY ./ . | |
RUN dotnet restore \ | |
&& dotnet build -c Release --no-restore | |
FROM base AS test | |
RUN dotnet test -c Release --no-build --logger trx | |
# Known issue if multiple tests projects complete within the same time down to | |
# millisecond difference then the test file will not be uniquely named and will | |
# be overwritten by preceding files with the same name. | |
FROM scratch AS test-results | |
COPY --from=test /app/tests/**/TestResults/*.trx . | |
FROM base as publish | |
RUN dotnet publish "./src/$project" -c Release --no-build -o /app/publish | |
FROM mcr.microsoft.com/dotnet/aspnet:6.0 | |
ARG project | |
WORKDIR /app | |
ENV APP_NAME "${project}.dll" | |
EXPOSE 80 | |
EXPOSE 443 | |
COPY --from=publish /app/publish . | |
ENTRYPOINT dotnet "$APP_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment