Skip to content

Commit

Permalink
Add Dockerfile for dotnet C#
Browse files Browse the repository at this point in the history
Signed-off-by: santoshkal <[email protected]>
  • Loading branch information
santoshkal committed Nov 7, 2023
1 parent c38ef30 commit eb3e7e2
Showing 1 changed file with 90 additions and 0 deletions.
90 changes: 90 additions & 0 deletions templates/dockerfile_samples/dotnet_csharp_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"dockerfile": [
{
"stage": 0,
"instructions": [
{
"from": [
"cgr.dev/chainguard/dotnet-sdk:latest-dev as builder"
]
},
{
"env": [
"APP_HOME=/source"
]
},
{
"run": [
"useradd -m -s /bin/bash -d $APP_HOME myappuser"
]
},
{
"workdir": [
"$APP_HOME"
]
},
{
"copy": [
"*.csproj ."
]
},
{
"run": [
"dotnet restore"
]
},
{
"copy": [
". ."
]
},
{
"run": [
"dotnet publish --no-restore -c Release -o /app/out"
]
}
]
},
{
"stage": 1,
"instructions": [
{
"from": [
"mcr.microsoft.com/dotnet/aspnet:6.0"
]
},
{
"env": [
"APP_USER=myappuser",
"APP_HOME=/app"
]
},
{
"run": [
"useradd -m -s /bin/bash -d $APP_HOME $APP_USER"
]
},
{
"workdir": [
"$APP_HOME"
]
},
{
"copy": [
"--from=builder $APP_HOME/out $APP_HOME/out"
]
},
{
"user": [
"$APP_USER"
]
},
{
"entrypoint": [
"dotnet","YourAppName.dll"
]
}
]
}
]
}

0 comments on commit eb3e7e2

Please sign in to comment.