I'm dockerizing legacy ASP.NET MVC 4.8, and I had this github actions that build the application.
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
name: Checkout Code
- name: Setup MSBuild Path
uses: warrenbuckley/Setup-MSBuild@v1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.2
- name: Restore NuGet Packages
run: nuget restore AspNetMVCApp.sln
- name: Build and Publish Web App
run: msbuild AspNetMVCApp.sln /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
- name: Upload Artifact
uses: actions/upload-artifact@v1.0.0
with:
name: aspnet-mvc-app
path: bin\Release\Publish
How do you get the published app and containerize it using something like the below
# FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
# WORKDIR /inetpub/wwwroot
# COPY /src/publish .
How do I use that published app and copy it to the /inetpub/wwwroot?
Add your Docker image definition to your GitHub repository under the name Dockerfile (no extension).
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8-windowsservercore-ltsc2019
WORKDIR /inetpub/wwwroot
COPY /src/publish .
Then append your with GitHub Workflow definition with a docker/build-push-action@v2 action like below. It'll automatically pickup the Dockerfile and use that to build an image. By default it should have access to everything in your repository and all build artifacts.
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: user/app:latest