Skip to content

dotNet 6 Angular 13 Remote Dev Container Template

Notifications You must be signed in to change notification settings

ids/angular-dotnet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET 6.0 and Angular 13.x in Dev Container

A base template for .NET 6 WebApi backend Angular 13 SPA frontend.

Here is what I have so far:

  • Serilog for logging.
  • Dapper for ORM.
  • EntityFramework Core as another ORM alternative, so hard to decide (used by OpenIddict too)
  • Swashbuckle Swagger and SwaggerUI.
  • TODO: cleanup sample db mess and move it into migrations
  • TODO: OpenIddict for authentication (IdentityServer seems to have taken a bad turn).

and a Dockerfile for deployment.

There is a sample data load script called sql-dataload.sql that can populate a sample DB. A few simple scripts for setting up a SQL Server docker container make it fairly straightforward.

Requirements for the Host Machine

  • .NET 6.0 Runtime (for the cert stuff, everything else happens in the dev container)
  • Docker Desktop
  • VSCode w/ Remote - Containers extensions installed

That should be it for the host!

You'll likely have other VSCode extensions for C#, etc...

HTTPS Setup

Initial setup involves sharing and trusting the development TLS cert so that it is trusted on both the host machine (by the browser), and also by the underlying proxy that runs in the docker environment and integrates with the SPA frameworks.

dotnet dev certs is handy for getting all this setup.

  1. Create the dev certificate. dotnet 6.0 SDK is required on the host machine in order to run the following command:
dotnet dev-certs https -ep ${HOME}/Workspace/certs/dotnetcert.pfx -p { password here }

By including the password both the public and private keys will be embedded in the pfx.

Note: the certificate is exported to ${HOME}/Workspace/certs/ as dotnetcert.pfx. Subsequent configurations expect this location and naming, and would need to be updated accordingly if changed.

  1. Trust the certificate on the host machine.
dotnet dev-certs https --trust

The command works it magic installing and trusting the certificate, and many sudo passwords will be entered.

The docker container will mount the host folder ~/Workspcae/certs, which is then specified in the .devcontainer.json via the ENV variable for the ASPNET runtime:

	"remoteEnv": {
	 	"ASPNETCORE_Kestrel__Certificates__Default__Password": "",
	   	"ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/dotnetcert.pfx"
    },

In this way both the containerized ASPNET server and the host browser use the same locally trusted dev certificate (which is bound to the name localhost).

About

dotNet 6 Angular 13 Remote Dev Container Template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published