Created
November 1, 2023 13:59
-
-
Save fokklz/c6c0bc00169f794d8e1dfa1a79e184cd to your computer and use it in GitHub Desktop.
Dockerfile for EF-Core Web API (net 0.7)
This file contains hidden or 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/aspnet:7.0 AS base | |
WORKDIR /app | |
EXPOSE 80 | |
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | |
WORKDIR /src | |
COPY ["MyWebApi.csproj", ""] | |
RUN dotnet restore "./MyWebApi.csproj" | |
COPY . . | |
WORKDIR "/src/." | |
RUN dotnet build "MyWebApi.csproj" -c Release -o /app/build | |
FROM build AS publish | |
RUN dotnet publish "MyWebApi.csproj" -c Release -o /app/publish | |
FROM base AS final | |
WORKDIR /app | |
COPY --from=publish /app/publish . | |
ENTRYPOINT ["dotnet", "MyWebApi.dll"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment