问题描述
在博文(【Azure App Service For Container】创建ASP.NET Core Blazor项目并打包为Linux镜像发布到Azure应用服务)中我们通过VS 2019可以为项目添加Dockerfile并自动生成Docker Image文件。但是如果不借助于VS2019我们如何来操作呢?
解决步骤
准备Dockerfile
进入项目文件夹中,创建Dockerfile并COPY以下内容:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
#Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
#For more information, please see https://aka.ms/containercompatFROM mcr.microsoft.com/dotnet/aspnet:5.0 AS baseFROM mcr.microsoft.com/dotnet