Skip to content

Commit 121a7e6

Browse files
committed
deployment and dockerfile
1 parent f2b903f commit 121a7e6

File tree

2 files changed

+40
-22
lines changed

2 files changed

+40
-22
lines changed

.github/workflows/dotnet.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name: .NET
55

66
env:
7-
registryName: {your_registry_name}.azurecr.io
7+
registryName: jo37jiy66vx2ympnpreg.azurecr.io
88
repositoryName: techexcel/dotnetcoreapp
99
dockerFolderPath: ./src/Application/src/RazorPagesTestSample
1010
tag: ${{github.run_number}}
@@ -55,22 +55,22 @@ jobs:
5555
- uses: actions/checkout@v3
5656

5757
- name: Docker Login
58-
# You may pin to the exact commit or the version.
59-
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
60-
uses: docker/[email protected]
61-
with:
62-
# Server address of Docker registry. If not set then will default to Docker Hub
63-
registry: ${{ secrets.ACR_LOGIN_SERVER }}
64-
# Username used to log against the Docker registry
65-
username: ${{ secrets.ACR_USERNAME }}
66-
# Password or personal access token used to log against the Docker registry
67-
password: ${{ secrets.ACR_PASSWORD }}
68-
# Log out from the Docker registry at the end of a job
69-
logout: true
70-
58+
# You may pin to the exact commit or the version.
59+
# uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
60+
uses: docker/[email protected]
61+
with:
62+
# Server address of Docker registry. If not set then will default to Docker Hub
63+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
64+
# Username used to log against the Docker registry
65+
username: ${{ secrets.ACR_USERNAME }}
66+
# Password or personal access token used to log against the Docker registry
67+
password: ${{ secrets.ACR_PASSWORD }}
68+
# Log out from the Docker registry at the end of a job
69+
logout: true
70+
7171
- name: Docker Build
7272
run: docker build -t $registryName/$repositoryName:$tag --build-arg build_version=$tag $dockerFolderPath
73-
73+
7474
- name: Docker Push
7575
run: docker push $registryName/$repositoryName:$tag
7676

@@ -80,7 +80,7 @@ jobs:
8080
needs: dockerBuildPush
8181
environment:
8282
name: dev
83-
url: https://{your_prefix}-dev.azurewebsites.net/
83+
url: https://jo37jiy66vx2y-dev.azurewebsites.net/
8484

8585
steps:
8686
- name: 'Login via Azure CLI'
@@ -90,7 +90,7 @@ jobs:
9090

9191
- uses: azure/webapps-deploy@v2
9292
with:
93-
app-name: '{your_prefix}-dev'
93+
app-name: 'jo37jiy66vx2y-dev'
9494
images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
9595

9696
deploy-to-test:
@@ -99,7 +99,7 @@ jobs:
9999
needs: deploy-to-dev
100100
environment:
101101
name: test
102-
url: https://{your_prefix}-test.azurewebsites.net/
102+
url: https://jo37jiy66vx2y-test.azurewebsites.net/
103103

104104
steps:
105105
- uses: actions/checkout@v3
@@ -111,7 +111,7 @@ jobs:
111111

112112
- uses: azure/webapps-deploy@v2
113113
with:
114-
app-name: '{your_prefix}-test'
114+
app-name: 'jo37jiy66vx2y-test'
115115
images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
116116

117117
deploy-to-prod:
@@ -120,7 +120,7 @@ jobs:
120120
needs: deploy-to-test
121121
environment:
122122
name: prod
123-
url: https://{your_prefix}-prod.azurewebsites.net/
123+
url: https://jo37jiy66vx2y-prod.azurewebsites.net/
124124

125125
steps:
126126
- uses: actions/checkout@v3
@@ -132,5 +132,5 @@ jobs:
132132

133133
- uses: azure/webapps-deploy@v2
134134
with:
135-
app-name: '{your_prefix}-prod'
136-
images: {your_registry_name}.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
135+
app-name: 'jo37jiy66vx2y-prod'
136+
images: jo37jiy66vx2ympnpreg.azurecr.io/techexcel/dotnetcoreapp:${{github.run_number}}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
2+
WORKDIR /app
3+
4+
# Copy csproj and restore as distinct layers
5+
COPY *.csproj ./
6+
RUN dotnet restore
7+
8+
# Copy everything else and build
9+
COPY . ./
10+
RUN dotnet publish -c Release -o out
11+
12+
# Build runtime image
13+
FROM mcr.microsoft.com/dotnet/aspnet:8.0
14+
WORKDIR /app
15+
COPY --from=build-env /app/out .
16+
# Default ASP.NET port changed with .NET 8.0
17+
ENV ASPNETCORE_HTTP_PORTS=80
18+
ENTRYPOINT ["dotnet", "RazorPagesTestSample.dll"]

0 commit comments

Comments
 (0)