How to add docker support for angualr7 application using VS2017

1/10/2019

I created Angular7 application using VS2017 by following this documentation. The application working fine in local machine, but I want to add the docker support for this angular application. And also deploy this into either local docker or local kubernetes.

So, can anyone help on that issue.

-- Pradeep
angular7
asp.net-core-webapi-2.1
docker
kubernetes
visual-studio-2017

1 Answer

1/10/2019

I do not know the book that you referenced. But in general the steps would be: - Try to run your application locally from command line (I guess it can be started with dotnet run). - Create a Dockerfile - Use official docker images that already include dotnet framework as Base-Image (e.g.: from microsoft/dotnet:runtime) - In your Dockerfile you can add as much as you want (install dependencies, run unit-tests, etc.), but to keep it simple the following should be enough:

Dockerfile:

from microsoft/dotnet:runtime
COPY . .
RUN dotnet restore
RUN dotnet build
ENTRYPOINT ["dotnet", "run"]
  • To optimize for performance you can use multi-stage docker images and split your Dockerfile into build and runtime

Note, that I didn't read your tutorial, but this is how I would start with preparing for docker

To work with kubernetes you can simply push your docker image (docker build -t <your-tag>) to a docker-registry, which your kubernetes cluster has access to and create a k8s-deployment for that contains that image. Locally you don't need a docker-registry but can simply kubectl run ...

See:

-- Peter Ittner
Source: StackOverflow