forked from readium/readium-lcp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathazure-pipelines-prod.yml
More file actions
75 lines (68 loc) · 2.69 KB
/
azure-pipelines-prod.yml
File metadata and controls
75 lines (68 loc) · 2.69 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
trigger:
- master
variables:
System.Debug: true
resourceGroup_prod: 'App-Lcp-Prod'
appName_prod: 'app-lcplsd-prod'
acrName_prod: 'lcslsdcontainer'
databaseUrl_prod: $(DATABASE_URL_PROD)
dockerComposeFile: 'ci/docker-compose.yaml' # Ensure this path is correct
containerRegistry: 'docker_lcp'
tag: 'latest'
stages:
- stage: BuildAndPush
displayName: Build and Push with Docker Compose
jobs:
- job: Build
displayName: Build and Push
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
- script: |
sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r .tag_name)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose --version
displayName: 'Install Docker Compose'
# Log in to Azure Container Registry
- task: Docker@2
displayName: 'Login to ACR'
inputs:
command: 'login'
containerRegistry: $(containerRegistry)
# Build and Push using Docker Compose
- script: |
docker-compose -f $(System.DefaultWorkingDirectory)/$(dockerComposeFile) build
docker-compose -f $(System.DefaultWorkingDirectory)/$(dockerComposeFile) push
displayName: 'Build and Push Docker Compose Images'
- stage: Deploy_Prod
displayName: Deploy to Prod
dependsOn: BuildAndPush
jobs:
- job: Deploy
steps:
- checkout: self
- task: AzureCLI@2
displayName: 'Login to Azure'
inputs:
azureSubscription: 'sc-acr-lcp-prod'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az account show
- task: AzureCLI@2
displayName: 'Deploy Prod'
inputs:
azureSubscription: 'sc-acr-lcp-prod'
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az webapp config container set \
--name $(appName_prod) \
--resource-group $(resourceGroup_prod) \
--multicontainer-config-type compose \
--multicontainer-config-file "$(System.DefaultWorkingDirectory)/$(dockerComposeFile)"
az webapp config appsettings set \
--name $(appName_prod) \
--resource-group $(resourceGroup_prod) \
--settings DATABASE_URL="$(databaseUrl_prod)"