Ramana Reddy

Ramana Reddy

  • 1.7k
  • 8
  • 454

docker file to deploy c# web api on IIS server

Dec 21 2023 10:27 AM

i have a web api and want create docker image, so i created docker file and trying to run but it is throwing exception when creating IIS web site

here is docker file

# escape=`

FROM mcr.microsoft.com/windows/servercore:ltsc2019

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]


# configure the new site in IIS.
RUN `
    New-Item -Path "C:\" -Name "Apigateway" -ItemType "directory";`
    Import-module Webadministration;`
    New-IISSite -Name "AxApigateway" -BindingInformation "*:8080:" -PhysicalPath 'C:\Apigateway';`

# This instruction tells the container to listen on port 83.

EXPOSE 83
# The final instruction copies the site you published earlier into the container.
COPY /Published/ C:\Apigateway
 


Answers (2)