1. 程式人生 > >我的Docke-CE學習筆記(04)

我的Docke-CE學習筆記(04)

soft 端口 space ati cor rom from docker program

Programs.cs內設置80端口

namespace User.API
{
    public class Program
    {
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup
<Startup>() .UseUrls("http://+:80") .Build(); } }

添加Dockerfile文件

FROM microsoft/aspnetcore-build as build-env
WORKDIR /code
COPY *.csproj ./
RUN dotnet restore
COPY . ./

RUN dotnet publish -c Release -o out

FROM microsoft/aspnetcore
WORKDIR /app
COPY --from=build-env /code/out
./ EXPOSE 80 RUN dotnet USER.API.dll

我的Docke-CE學習筆記(04)