forked from microsoft/AzureTRE
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines-rshiny.yml
53 lines (43 loc) · 1.54 KB
/
azure-pipelines-rshiny.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
name: $(Date:yyyyMMdd).$(Rev:r)
trigger: none
parameters:
- name: environment
displayName: Environment
type: string
default: azuretre-dev
values:
- "azuretre-dev"
variables:
- group: '${{ parameters.environment }}'
- name: DOCKER_DIRECTORY
value: 'templates/workspace_services/rshiny/rshiny-app'
- name: DOCKER_FILE
value: 'templates/workspace_services/rshiny/rshiny-app/Dockerfile'
- name: VERSION_FILE
value: 'templates/workspace_services/rshiny/version.txt'
jobs:
- job:
displayName: 'Build RShiny App'
steps:
- task: AzureCLI@2
displayName: 'Build and Push'
inputs:
azureSubscription: $(AZURE_CREDENTIALS)
addSpnToEnvironment: true
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
set -e
version_file='$(VERSION_FILE)'
acr_name='$(ACR_NAME)'
image_name_prefix="microsoft/azuretre"
image_name="rshiny-workspace-service"
version_line=$(cat "${version_file}")
version_array=( ${version_line//=/ } )
version="${version_array[1]//\"}"
./devops/scripts/login_acr.sh $acr_name
acr_domain_suffix=`az cloud show --query suffixes.acrLoginServerEndpoint --output tsv`
acr_fqdn="${acr_name}${acr_domain_suffix}"
full_image_name_prefix=${acr_fqdn}/${image_name_prefix}
docker build -t "${full_image_name_prefix}/${image_name}:${version}" -f "$(DOCKER_FILE)" "$(DOCKER_DIRECTORY)"
docker push "${full_image_name_prefix}/${image_name}:${version}"