Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You will need the following things installed on your system to walk through thes
- If you are running on Mac or want to use VS Code:
- [VSCode for Windows, Mac, or Linux](https://code.visualstudio.com/download) or other text editor (Vim, Sublime, etc...)
- [C# for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp)
- [.NET Core 6.0 SDK](https://www.microsoft.com/net/download/all) for running our ASP.NET Core projects
- [.NET Core 6.0 SDK or 7.0](https://www.microsoft.com/net/download/all) for running our ASP.NET Core projects

## Creating an ASP.NET Core Web API

Expand Down Expand Up @@ -83,6 +83,11 @@ The file itself will only have the code sections that you need to type, in betwe
```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
```
if you are using .NET 7 instead of 6, use below

```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
```

Next we set the working directory and `EXPOSE` port 5000. This is where we will be building the app:

Expand Down Expand Up @@ -117,7 +122,16 @@ COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "TodoApi.dll"]
```

If you are using .NET 7 instead of 6 use the below,

```dockerfile
# Build runtime image.
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "TodoApi.dll"]
In total the **Dockerfile** will look like:
```

```dockerfile
# syntax=docker/dockerfile:1
Expand Down Expand Up @@ -913,4 +927,12 @@ This will give you access to your dashboard as seen below. You can get all the s

From here feel free to play around with your cluster search the Kubectl commands (Kubectl --help) to remove pods, add pods, check on health, modify your Yaml. Its just a demo so its ok if you break it.

### Clean up

Optional: If you like to clean up the Azure resources that have been created in this course, you can delete the resource group using the following command

```bash
az group delete --name todoapirg
```

Enjoy!!
11 changes: 8 additions & 3 deletions aks.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: todo
labels:
deploy: todo
spec:
replicas: 3
selector:
matchLabels:
app: todo
template:
metadata:
labels:
app: todo
spec:
containers:
- name: todo
image: todov1registry.azurecr.io/todov1
image: "todov1registry.azurecr.io/todov1"
ports:
- containerPort: 80
resources:
Expand All @@ -20,7 +25,7 @@ spec:
limits:
cpu: 500m
imagePullSecrets:
- name: todov1secret
- name: todoapisecret
---
apiVersion: v1
kind: Service
Expand Down