• 打包一个传统的ASP.NET web app作为Docker镜像


    (1)针对NerdDinner应用的Dockerfile内容如下

    PS E:DockeronWindowsChapter02ch02-nerd-dinner> cat .Dockerfile
    # escape=`
    FROM sixeyed/msbuild:netfx-4.5.2-webdeploy-10.0.14393.1198 AS builder

    WORKDIR C:srcNerdDinner
    COPY srcNerdDinnerpackages.config .
    RUN nuget restore packages.config -PackagesDirectory ..packages

    COPY src C:src
    RUN msbuild NerdDinner.csproj /p:OutputPath=c:outNerdDinner `
             /p:DeployOnBuild=true /p:VSToolsPath=C:MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3 oolsVSToolsPath

    # app image
    FROM microsoft/aspnet:windowsservercore-10.0.14393.1198
    SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

    ENV BING_MAPS_KEY bing_maps_key
    WORKDIR C: erd-dinner

    RUN Remove-Website -Name 'Default Web Site'; `
         New-Website -Name 'nerd-dinner' `
                     -Port 80 -PhysicalPath 'c: erd-dinner' `
                     -ApplicationPool '.NET v4.5'

    RUN & c:windowssystem32inetsrvappcmd.exe `
           unlock config `
           /section:system.webServer/handlers

    COPY --from=builder C:outNerdDinner\_PublishedWebsitesNerdDinner C: erd-dinner


    (2)进行构建镜像

    PS E:DockeronWindowsChapter02ch02-nerd-dinner> docker container run -d -P dockeronwindows/ch02-nerd-dinner


    (3)通过docker container inspect获得容器的IP地址


    (4)访问服务应该如下所示:

    docker container run -d -P dockeronwindows/ch02-nerd-dinner

  • 相关阅读:
    冲刺第二天4-25
    个人任务记录
    冲刺第一天
    每日站立会议4-20(张硕)
    每日站立会议4-19
    每日站立会议4-17(张硕)
    每日站立会议 4-16(蔡迎盈编写)
    每日站立会议 4-15(张硕编写)
    每日站立会议 4-12(张硕编写)
    继Spring 会议个人计划统计(补)
  • 原文地址:https://www.cnblogs.com/zangxueyuan/p/9153866.html
Copyright © 2020-2023  润新知