Skip to content

Commit c32da31

Browse files
committed
Refactor dotnet.yml to update Azure Login action to use version 2 and use Azure credentials for authentication, include specific paths for push and pull_request events, and update Dockerfile for .NET 8
1 parent a05aa30 commit c32da31

File tree

2 files changed

+74
-2
lines changed

2 files changed

+74
-2
lines changed

.github/workflows/dotnet.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,76 @@ jobs:
7979
--docker-custom-image-name ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} \
8080
--docker-registry-server-url https://${{ env.registryName }} \
8181
--docker-registry-server-user ${{ secrets.ACR_USERNAME }} \
82+
--docker-registry-server-password ${{ secrets.ACR_PASSWORD }}
83+
84+
deploytodev:
85+
runs-on: ubuntu-latest
86+
needs: buildacr
87+
environment: dev
88+
89+
steps:
90+
- uses: actions/checkout@v4
91+
92+
- name: Azure Login
93+
uses: azure/login@v2
94+
with:
95+
creds: ${{ secrets.AZURE_CREDENTIALS }}
96+
97+
98+
- name: Deploy to Azure Web App
99+
run: |
100+
az webapp config container set \
101+
--name q3zpru2gmy754-dev \
102+
--resource-group ${{ secrets.AZURE_RG }} \
103+
--docker-custom-image-name ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} \
104+
--docker-registry-server-url https://${{ env.registryName }} \
105+
--docker-registry-server-user ${{ secrets.ACR_USERNAME }} \
106+
--docker-registry-server-password ${{ secrets.ACR_PASSWORD }}
107+
108+
deploytotest:
109+
runs-on: ubuntu-latest
110+
needs: deploytodev
111+
environment: test
112+
113+
steps:
114+
- uses: actions/checkout@v4
115+
116+
- name: Azure Login
117+
uses: azure/login@v2
118+
with:
119+
creds: ${{ secrets.AZURE_CREDENTIALS }}
120+
121+
122+
- name: Deploy to Azure Web App
123+
run: |
124+
az webapp config container set \
125+
--name q3zpru2gmy754-test \
126+
--resource-group ${{ secrets.AZURE_RG }} \
127+
--docker-custom-image-name ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} \
128+
--docker-registry-server-url https://${{ env.registryName }} \
129+
--docker-registry-server-user ${{ secrets.ACR_USERNAME }} \
130+
--docker-registry-server-password ${{ secrets.ACR_PASSWORD }}
131+
132+
deploytoprod:
133+
runs-on: ubuntu-latest
134+
needs: deploytotest
135+
environment: prod
136+
137+
steps:
138+
- uses: actions/checkout@v4
139+
140+
- name: Azure Login
141+
uses: azure/login@v2
142+
with:
143+
creds: ${{ secrets.AZURE_CREDENTIALS }}
144+
145+
146+
- name: Deploy to Azure Web App
147+
run: |
148+
az webapp config container set \
149+
--name q3zpru2gmy754-prod \
150+
--resource-group ${{ secrets.AZURE_RG }} \
151+
--docker-custom-image-name ${{ env.registryName }}/${{ env.repositoryName }}:${{ env.tag }} \
152+
--docker-registry-server-url https://${{ env.registryName }} \
153+
--docker-registry-server-user ${{ secrets.ACR_USERNAME }} \
82154
--docker-registry-server-password ${{ secrets.ACR_PASSWORD }}

src/Application/src/RazorPagesTestSample/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Update the base and SDK images to .NET 8
22
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
33
WORKDIR /app
4-
EXPOSE 8080
5-
EXPOSE 8081
4+
EXPOSE 80
5+
ENV ASPNETCORE_URLS=http://+:80
66

77

88
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build

0 commit comments

Comments
 (0)