Skip to content

Commit ba6d349

Browse files
committed
chore: Add ASP.NET Core pipeline configuration and variables for Docker image build and push
1 parent 86745fd commit ba6d349

File tree

1 file changed

+65
-0
lines changed
  • content/en/templates/tutorials/azuredevops-project

1 file changed

+65
-0
lines changed

content/en/templates/tutorials/azuredevops-project/index.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,70 @@ stages:
254254
tags: "$(Build.BuildId),latest"
255255
```
256256
257+
258+
```yaml
259+
# ASP.NET Core (.NET Framework)
260+
# Build and test ASP.NET Core projects targeting .NET9.
261+
# Add steps that publish symbols, save build artifacts, and more:
262+
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
263+
264+
# Before run pipeline please check the variables
265+
# *** Service Connection ***
266+
# AcrConnectionDev (Service connection to Azure Container Registry for development)
267+
# AcrConnectiionUAT (Service connection to Azure Container Registry for UAT)
268+
# AcrConnectionProd (Service connection to Azure Container Registry for production)
269+
270+
# *** General variables ***
271+
# BuildConfiguration (Release or Debug)
272+
273+
274+
275+
# *** Pipeline variables ***
276+
#
277+
278+
279+
name: $(Build.BuildId)
280+
281+
trigger:
282+
- none
283+
284+
resources:
285+
- repo: self
286+
287+
variables:
288+
vmImageName: "ubuntu-latest" # Agent VM image name
289+
imageName: fiscanner-hello # Your image name
290+
dockerfile: Dockerfile # Your Dockerfile path
291+
containerArgs: "--build-arg GREETING=Souch beautifull" # Argument to pass to the container
292+
293+
stages:
294+
- stage: BuildAndPush
295+
displayName: Build and Push Docker Image
296+
jobs:
297+
- job: DEV
298+
displayName: Build Docker Image
299+
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/develop'), eq(variables['envName'], 'dev'))
300+
pool:
301+
vmImage: $(vmImageName)
302+
steps:
303+
- task: Docker@2
304+
displayName: Build
305+
inputs:
306+
command: build
307+
repository: $(imageName)
308+
tags: "$(Build.BuildId),latest" # Use build number as tag
309+
dockerfile: $(dockerfile)
310+
buildArgs: containerArgs # Pass the the build argument
311+
containerRegistry: "AcrConnection2025"
312+
313+
- task: Docker@2
314+
displayName: Push
315+
inputs:
316+
command: push
317+
repository: $(imageName)
318+
tags: "$(Build.BuildId),latest" # Use build number as tag
319+
containerRegistry: "AcrConnection2025"
320+
```
321+
257322
## Conclusion
258323
Enjoy your new project on Azure DevOps!

0 commit comments

Comments
 (0)