forked from mohamedsaif/IntelligentExperiences.OnContainers
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathazure-pipelines-webapp-containers.yml
87 lines (78 loc) · 2.9 KB
/
azure-pipelines-webapp-containers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Azure Pipelines for .NET Core app (Web, Function, ....) :)
# More info: https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=vsts
parameters:
Name: 'ASPNetCoreWebApp'
RestoreBuildProjects: '**/*.API.csproj'
BuildConfiguration: 'Release'
WorkingDirectory: 'src'
PublishWebApp: True
ArtifactName: 'AppDrop'
ZipAfterPublish: True
DeploymentSourceFolder: 'src/deployment'
ContainerRegistryName: myacr
ContainerRegistryServiceConnection: myacr
ContainerRegistryRepo: projectname
DockerFilePath: 'src'
jobs:
- job: ${{ Parameters.Name }}
pool:
vmImage: 'ubuntu-16.04'
demands: npm
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
feedsToUse: config
nugetConfigPath: '${{ Parameters.WorkingDirectory }}/nuget.config'
projects: ${{ Parameters.RestoreBuildProjects }}
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: ${{ Parameters.RestoreBuildProjects }}
arguments: '--configuration ${{ Parameters.BuildConfiguration }}'
workingDirectory: ${{ Parameters.WorkingDirectory }}
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: ${{ Parameters.PublishWebApp }}
arguments: '--configuration ${{ Parameters.BuildConfiguration }} --output $(build.artifactstagingdirectory)/app'
zipAfterPublish: ${{ Parameters.ZipAfterPublish }}
workingDirectory: ${{ Parameters.WorkingDirectory }}
# - task: qetza.replacetokens.replacetokens-task.replacetokens@3
# displayName: 'Replace tokens in deployment/*.yaml'
# inputs:
# rootDirectory: '${{ Parameters.DeploymentSourceFolder }}'
# targetFiles: '**/*.yaml'
- task: CopyFiles@2
displayName: 'Copy Deployment Files'
inputs:
SourceFolder: ${{ Parameters.DeploymentSourceFolder }}
TargetFolder: '$(build.artifactstagingdirectory)/deployment'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: ${{ Parameters.ArtifactName }}'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: ${{ Parameters.ArtifactName }}
zipAfterPublish: True
- job: BuildImage
displayName: 'BuildImages-${{ Parameters.Name }}'
dependsOn: ${{ Parameters.Name }}
pool:
vmImage: 'ubuntu-16.04'
steps:
- task: Docker@2
displayName: 'Docker Build'
inputs:
containerRegistry: ${{ Parameters.ContainerRegistryServiceConnection }}
repository: '${{ Parameters.ContainerRegistryName }}${{ Parameters.ContainerRegistryRepo }}'
command: build
Dockerfile: ${{ Parameters.DockerFilePath }}
- task: Docker@2
displayName: 'Docker Push'
inputs:
containerRegistry: ${{ Parameters.ContainerRegistryServiceConnection }}
repository: '${{ Parameters.ContainerRegistryName }}${{ Parameters.ContainerRegistryRepo }}'
command: push
Dockerfile: ${{ Parameters.DockerFilePath }}