Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

README.txt
==========

Project: Multistage Docker Setup for Vue.js Frontend + ASP.NET Core Backend on IIS
-----------------------------------------------------------------------------------

This project demonstrates a multistage Docker build that:

  β€’ Builds a Vue.js single-page application  
  β€’ Builds an ASP.NET Core Web API  
  β€’ Combines both into a final IIS-based Windows container  

The result is a single Docker image that serves your front-end on port 80 and your back-end on port 81.

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

1. Prerequisites
----------------
  β€’ Windows host (Server Core) with Docker Desktop installed and set to β€œWindows containers”  
  β€’ Docker CLI (docker build, docker run) available in PATH  
  β€’ Git (to clone this repo)  
  β€’ Ports 80 and 81 free on your machine  

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

2. Directory Structure
----------------------
/project-root
/front/ ← Vue.js source (package.json, src/, public/)
/back/ ← ASP.NET Core source ( .csproj, Controllers/, Program.cs, etc.)
Dockerfile ← Multistage build instructions
applicationHost.config (optional) ← Custom IIS config
README.txt


––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

3. Dockerfile Explanation
--------------------------
The Dockerfile contains three stages:

Stage 1 – Node build  
  β€’ Base image: Windows Server Core  
  β€’ Installs Node.js  
  β€’ Copies /front, runs `npm install` and `npm run build`  
  β€’ Outputs static files to `C:\app\dist`

Stage 2 – .NET build  
  β€’ Base image: mcr.microsoft.com/dotnet/sdk:6.0-windowsservercore  
  β€’ Copies /back, runs `dotnet publish -c Release`  
  β€’ Outputs binaries to `C:\publish`

Stage 3 – Final IIS image  
  β€’ Base image: mcr.microsoft.com/windows/servercore/iis:ltsc2022  
  β€’ Installs the .NET Hosting Bundle  
  β€’ Copies `C:\app\dist` β†’ `C:\inetpub\wwwroot\front`  
  β€’ Copies `C:\publish`   β†’ `C:\inetpub\wwwroot\back`  
  β€’ Uses PowerShell to create two IIS sites:
      – β€œFrontApp” on port 80  
      – β€œBackApp”  on port 81  

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

4. Building the Docker Image
-----------------------------
From the project root, run:

  docker build -t weinno/multistage-app:latest .

This will download all necessary base images, build both front and back ends, and produce a final IIS image.

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

5. Running the Container
-------------------------
Run the container with:

  docker run -d ^
    -p 80:80   `
    -p 81:81   `
    --name multistage-app `
    weinno/multistage-app:latest

  β€’ Your Vue.js app is now at http://localhost/  
  β€’ Your ASP​.NET Core API is at http://localhost:81/

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

6. Configuration Tips
---------------------
  β€’ If you need custom IIS settings, add an `applicationHost.config` next to the Dockerfile.  
  β€’ Verify that your back-end `.dll` names match those in `web.config` if you use one.  
  β€’ Do not enable IIS logging in `web.config` β€” it may prevent containers from starting.  

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

7. Pushing to Harbor
--------------------
After building, tag and push to your private registry:

  docker tag weinno/multistage-app:latest harbor.weinno.ir/library/multistage-app:latest  
  docker push harbor.weinno.ir/library/multistage-app:latest

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

8. Cleanup
----------
To stop and remove the running container:

  docker stop multistage-app  
  docker rm multistage-app

To remove the image:

  docker rmi weinno/multistage-app:latest

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

9. Support
----------
For questions, see our Confluence page:  
https://confluence.weinno.ir/display/DOCKER/Multistage+Docker+Setup  

––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

_Last updated: 20 May 2025_  

About

Multi-Stage Dockerization on iis Windows - Frontend: Vue.js - Backend: ASP.NET Core - Database: SQL Server

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages