Git Product home page Git Product logo

nhs-cac-docker-dotnetwebapp's Introduction

Example myWebApp

This is a Dockerized .NET Core 3.1 application of an example Covid-19 registration form. Used for educational purposes only!

  • if you check the Dockerfile you see that it uses the image mcr.microsoft.com/dotnet/core/sdk:3.1 as building environment. You can use the dotnet CLI to create applications. See: https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/install
  • The example webapplication was made as follows:
    • dotnet new webApp -o myWebApp --no-https
    • cd myWebApp
    • dotnet watch build
    • dotnet run
  • After that I created a Dockerfile inside the myWebApp folder. See example: https://docs.docker.com/engine/examples/dotnetcore/
    • Be sure all folder and .dll references to the folder named by your application (in my case 'myWebApp') !!
    • It uses a command to output the buildfiles to a folder using:
    • dotnet publish -c Release -o out
  • I used an example Covid-19 registration form as an example to make it look better. Original source: https://111.nhs.uk/.
  • I changed the pages:
    • ./Pages/index.cshtml
    • ./Pages/Shared/_Layout.cshtml
  • And added some resources:
    • ./wwwroot/index_files/

How to run

Download source and unzip

git clone https://github.com/looking4ward/nhs-cac-docker-dotnetwebapp.git

Enter folder

cd nhs-cac-docker-dotnetwebapp/

Build docker image

docker build -t aspnetapp:latest .

  • Build from current directory (.) and name it aspnetapp:latest

Run container

docker run -d -p 5000:80 --name myWebApp aspnetapp:latest

  • Expose to http port to external port (default: 5000). Assign myWebApp as name. Use -d for detach mode (e.g background, instead of interactive mode -i)

Test it in browser

http://localhost:5000

Extra: inspect container

docker inspect myWebApp

Extra: run commands

docker exec myWebApp tail ../etc/os-release

  • For example: tail [file]) in container

nhs-cac-docker-dotnetwebapp's People

Contributors

looking4ward avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.