-
Notifications
You must be signed in to change notification settings - Fork 30
/
.azure-pipelines.yml
58 lines (52 loc) · 1.42 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
name: lb-docker-build
trigger:
branches:
include:
- develop
- master
- refs/tags/*
pr:
branches:
include:
- develop
pool:
vmImage: 'ubuntu-latest'
variables:
${{ if eq(variables['Build.SourceBranchName'], 'master') }}:
customTag: 'latest'
${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
customTag: $(Build.SourceBranchName)
jobs:
- job: pullrequests
displayName: "Pull Request build test"
condition: eq(variables['Build.Reason'], 'PullRequest')
steps:
- task: Docker@2
displayName: Build LB image
inputs:
containerRegistry: 'dockerhub'
repository: 'anakhon/lazyblacksmith'
command: 'build'
Dockerfile: '**/Dockerfile'
arguments: '--rm'
addPipelineData: false
buildContext: $(Build.SourcesDirectory)
- job: BuildAndPushToDockerHub
displayName: 'Build and Push to Docker Hub'
condition: ne(variables['Build.Reason'], 'PullRequest')
steps:
- task: Docker@2
displayName: Login to Docker Registry
inputs:
command: login
containerRegistry: 'dockerhub'
- task: Docker@2
displayName: Build & Push LB image
inputs:
containerRegistry: 'dockerhub'
repository: 'anakhon/lazyblacksmith'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: $(customTag)
addPipelineData: false
buildContext: $(Build.SourcesDirectory)