How to add sub-directory to my web application on IIS running in a Docker Container?

Viewed 166

I have a solution containing 2 projects, 1 is my WCF web service and 1 is a front-end web page made on ASP.NET MVC 4. I decided to containerize these 2 projects so I can do API testing with CI.

But I am having trouble making a subdirectory just like the one in a locally installed IIS. This is where I normally deploy my builds on my local machine without Docker:

enter image description here

Since I am deploying this way, each applications has sub-directories like this

enter image description here

Now that I am using Docker, I wanted to replicate this setup. I have tried adding WORKDIR /inetpub/wwwroot/FormulaBuilder on my dockerfile whereas FormulaBuilder is the sub-directory, but it didn't work. I get this error instead:

enter image description here

Both my web service and the front-end web-page works if you setup both on different ports. But I wanted to remove the ports so I don't have to deal with conflicts when I'm updating Service References on my project. In addition, I wanted to be as close to the production setup as possible when performing API testing.

Is it possible to add sub-directories with the use of IIS that came with the base image? If so, how do you do it? Below are my docker files:

FBSVC (WCF web service project)

FROM mcr.microsoft.com/dotnet/framework/wcf:4.8
ARG source=bin/app.publish
WORKDIR /inetpub/wwwroot/
COPY ${source:-obj/Docker/publish} .
EXPOSE 80

FormulaBuilder (Front-end web page project)

FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8
ARG source=bin/app.publish
WORKDIR /inetpub/wwwroot/FormulaBuilder
COPY ${source:-obj/Docker/publish} .
EXPOSE 80

Docker Compose

version: "3"
services:
  web-service:
    build: ./FBSVC
    container_name: "FBSVC"
    ports:
      - "5001:80"

  front-end:
    build: ./FormulaBuilder
    container_name: "FormulaBuilder"
    ports:
      - "5000:80"

I am new to Docker and I am still exploring things. Any help would be appreciated. Thanks!

0 Answers
Related