Skip to content

Instantly share code, notes, and snippets.

@atlemagnussen
Created March 11, 2023 13:11
Show Gist options
  • Save atlemagnussen/8319b79858eed421c1146b97a187d84a to your computer and use it in GitHub Desktop.
Save atlemagnussen/8319b79858eed421c1146b97a187d84a to your computer and use it in GitHub Desktop.
asp.net 6 dockerfile
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
RUN dotnet restore "WebApplication1/WebApplication1.csproj"
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build "WebApplication1.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebApplication1.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment