-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-image-template.yaml
54 lines (47 loc) · 1.28 KB
/
build-image-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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
parameters:
WIN_VERSION: 'windowsservercore-1809'
steps:
- script: |
echo ##vso[task.setvariable variable=ES_FROM]openjdk:$(JDK_VERSION)-jdk-${{ parameters.WIN_VERSION }}
echo ##vso[task.setvariable variable=ES_TAG]$(ES_VERSION)-${{ parameters.WIN_VERSION }}
- pwsh: |
$lines = @()
foreach($line in Get-Content -Path 'Dockerfile')
{
if($line.StartsWith('FROM '))
{
$lines += "FROM $($env:ES_FROM)"
}
else
{
$lines += $line
}
}
$lines | Write-Host
$lines | Set-Content -Path 'Dockerfile'
- task: Docker@2
displayName: login on docker hub
inputs:
command: login
containerRegistry: docker-hub-gigi81
- task: Docker@2
displayName: image build
inputs:
command: build
repository: gigi81/elasticsearch-windows
dockerfile: Dockerfile
arguments: --build-arg ARG_VERSION="$(ES_VERSION)"
tags: $(ES_TAG)
- script: docker run -d -p 9200:9200 -p 9300:9300 --name elasticsearch gigi81/elasticsearch-windows:%ES_TAG%
- task: PowerShell@2
displayName: test image
inputs:
targetType: filePath
filePath: test.ps1
arguments: -Version $(ES_VERSION)
- task: Docker@2
displayName: publish docker image
inputs:
command: push
repository: gigi81/elasticsearch-windows
tags: $(ES_TAG)