forked from deadlysyn/terraform-keycloak-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
83 lines (74 loc) · 2.84 KB
/
azure-pipelines.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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- main
pool:
vmImage: ubuntu-latest
resources:
- repo: self
variables:
- group: aws
- name: tag
value: '$(Build.BuildId)'
- name: DOCKER_REPOSITORY
value: $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/autologgids-dev
- name: DOCKER_REPOSITORY_STAGING
value: $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/autologgids-staging
- name: DOCKER_REPOSITORY_PROD
value: $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/autologgids-prod
stages:
- stage: Build
displayName: Build
jobs:
- job: Build
displayName: Build
steps:
- task: Bash@3
displayName: 'Login to ECR'
inputs:
targetType: 'inline'
script: |
aws ecr get-login-password --region $(AWS_REGION) | docker login --username AWS --password-stdin $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
- task: Bash@3
displayName: 'Build theme'
inputs:
workingDirectory: build/keycloak
targetType: 'inline'
script: |
chmod 755 package.sh
./package.sh autologg
- task: Docker@2
displayName: Build an image
inputs:
command: build
buildContext: $(Build.SourcesDirectory)/build/keycloak
dockerfile: '$(Build.SourcesDirectory)/build/keycloak/Dockerfile'
tags: |
$(DOCKER_REPOSITORY):$(Build.BuildId)
$(DOCKER_REPOSITORY):$(Build.BuildNumber)
$(DOCKER_REPOSITORY):latest
$(DOCKER_REPOSITORY_STAGING):$(Build.BuildId)
$(DOCKER_REPOSITORY_STAGING):$(Build.BuildNumber)
$(DOCKER_REPOSITORY_STAGING):latest
arguments: -t $(DOCKER_REPOSITORY):$(Build.BuildId) -t $(DOCKER_REPOSITORY):latest -t $(DOCKER_REPOSITORY):$(Build.BuildNumber) -t $(DOCKER_REPOSITORY_STAGING):$(Build.BuildId) -t $(DOCKER_REPOSITORY_STAGING):latest -t $(DOCKER_REPOSITORY_STAGING):$(Build.BuildNumber)
- task: Docker@2
inputs:
repository: $(DOCKER_REPOSITORY)
command: 'push'
tags: |
latest
$(Build.BuildId)
$(Build.BuildNumber)
- task: Docker@2
inputs:
repository: $(DOCKER_REPOSITORY_STAGING)
command: 'push'
tags: |
latest
$(Build.BuildId)
$(Build.BuildNumber)