-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-and-push-template.yaml
30 lines (29 loc) · 1.33 KB
/
build-and-push-template.yaml
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
parameters:
- name: subfolder
type: string
default: false
jobs:
- job: ${{ parameters.subfolder }}
steps:
- bash: |
IMAGE_TAG=$(cat ./${{ parameters.subfolder }}/version)
echo $IMAGE_TAG
echo "##vso[task.setvariable variable=tag;isOutput=true]$IMAGE_TAG"
name: ${{ parameters.subfolder }}
displayName: get ${{ parameters.subfolder }} version
- task: Docker@2
displayName: Build ${{ parameters.subfolder }} image
inputs:
command: "build"
Dockerfile: "./${{ parameters.subfolder }}/Dockerfile"
arguments: "-t ${{ parameters.subfolder }}:$(${{ parameters.subfolder }}.tag)"
- task: AWSShellScript@1
inputs:
awsCredentials: 'datadelivery-aws-deploy'
regionName: 'eu-central-1'
scriptType: 'inline'
inlineScript: |
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/v1w7b9k4
docker tag ${{ parameters.subfolder }}:$(${{ parameters.subfolder }}.tag) public.ecr.aws/v1w7b9k4/${{ parameters.subfolder }}:$(${{ parameters.subfolder }}.tag)
docker push public.ecr.aws/v1w7b9k4/${{ parameters.subfolder }}:$(${{ parameters.subfolder }}.tag)
displayName: Push ${{ parameters.subfolder }} image