-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
79 lines (71 loc) · 2.4 KB
/
azure-pipelines.yml
File metadata and controls
79 lines (71 loc) · 2.4 KB
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
trigger:
- main
resources:
- repo: self
variables:
dockerRegistryServiceConnection: "256bec6c-8e4f-4886-9d5b-e3ae4e6407d2"
azureSubscription: "azureSubscription"
acrLoginServer: "acrincludia2771.azurecr.io"
imageRepository: "includia-java-api"
webAppName: "app-includia-java-2771"
# CORREÇÃO: Usando a raiz (.), pois seus arquivos parecem estar na base do repo
javaRootPath: "."
dockerfilePath: "$(javaRootPath)/dockerfile"
tag: "$(Build.BuildId)"
vmImageName: "ubuntu-latest"
stages:
- stage: Build
displayName: Build and Push Stage
jobs:
- job: Build
displayName: Build
pool:
vmImage: $(vmImageName)
steps:
# [DEBUG] Lista os arquivos para sabermos onde está o gradlew se falhar
- script: |
echo "📂 Estrutura de arquivos na raiz:"
ls -R
displayName: "Debug: List Files"
- task: JavaToolInstaller@0
inputs:
versionSpec: "21"
jdkArchitectureOption: "x64"
jdkSourceOption: "PreInstalled"
displayName: "Setup Java 21"
- script: chmod +x $(javaRootPath)/gradlew
displayName: "Grant execute permission to gradlew"
- task: Docker@2
displayName: Build and push an image to container registry
inputs:
command: buildAndPush
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
buildContext: "$(javaRootPath)"
tags: |
$(tag)
latest
- stage: Deploy
displayName: Deploy Stage
dependsOn: Build
condition: succeeded()
jobs:
- deployment: Deploy
displayName: Deploy to Azure Web App
environment: "production"
pool:
vmImage: $(vmImageName)
strategy:
runOnce:
deploy:
steps:
- task: AzureWebAppContainer@1
displayName: "Azure Web App Deploy (Container)"
inputs:
azureSubscription: $(azureSubscription)
appName: $(webAppName)
containers: $(acrLoginServer)/$(imageRepository):$(tag)
appSettings: |
-SPRING_PROFILES_ACTIVE "prod"
-PORT 80