-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (109 loc) · 4.54 KB
/
docker.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Docker Build ⚓
on: [push, pull_request]
jobs:
# Single job now to build Docker Image, run GHC unit tests, and push to DockerHub
build_test_push:
name: Build and Publish
runs-on: ubuntu-latest
strategy:
matrix:
include:
- output: "elasticsearch"
logstash-version: 7.17.14
logstash-branch: 7.17
elasticsearch-version: 7
prefix: ""
tags-latest: "latest"
- output: "elasticsearch"
logstash-version: 8.1.3
logstash-branch: 8.1
elasticsearch-version: 8
prefix: ""
tags-latest: "8.1"
- output: "elasticsearch"
logstash-version: 8.2.3
logstash-branch: 8.2
elasticsearch-version: 8
prefix: ""
tags-latest: "8.2"
- output: "elasticsearch"
logstash-version: 8.3.3
logstash-branch: 8.3
elasticsearch-version: 8
prefix: ""
tags-latest: "8.3"
- output: "elasticsearch"
logstash-version: 8.4.2
logstash-branch: 8.4
elasticsearch-version: 8
prefix: ""
tags-latest: "8.4"
# v2 https://github.com/docker/build-push-action/blob/master/UPGRADE.md
steps:
- name: Checkout ✅
uses: actions/checkout@v4
- name: Config 📦
run: |
echo output=${{ matrix.output }}
echo prefix=${{ matrix.prefix }}
echo logstash-version=${{ matrix.logstash-version }}
echo logstash-branch=${{ matrix.logstash-branch }}
echo elasticsearch-version=${{ matrix.elasticsearch-version }}
echo tags-latest=${{ matrix.tags-latest }}
- name: Prepare 📦
id: prep
run: |
DOCKER_IMAGE=anasoid/jmeter-logstash
VERSION="${{ matrix.prefix }}${{ matrix.logstash-version }}"
echo "image=${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
if [[ "${{ matrix.with-plugins }}" == "true" ]];then echo "suffix=-plugins" >> $GITHUB_OUTPUT; else echo "suffix=" >> $GITHUB_OUTPUT; fi;
- name: Show Image Settings 📦
run: echo "IMAGE=${{ steps.prep.outputs.image }} VERSION=${{ steps.prep.outputs.version }}"
- name: Set up Docker Buildx 📦
id: buildx
uses: docker/setup-buildx-action@v2
- name: Inspect builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Docker Build only - retain local Image 📦
id: build
uses: docker/build-push-action@v4
with:
context: .
file: docker/${{ matrix.output }}/Dockerfile
load: true
push: false
build-args: |
LOGSTASH_VERSION=${{ matrix.logstash-version }}
ELASTICSEARCH_VERSION=${{ matrix.elasticsearch-version }}
tags: |
${{ steps.prep.outputs.image }}:${{ matrix.prefix }}${{ matrix.logstash-version }}
${{ steps.prep.outputs.image }}:${{ matrix.prefix }}${{ matrix.logstash-branch }}
${{ steps.prep.outputs.image }}:${{ matrix.tags-latest }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ github.sha }}
- name: Result 📦
id: result
run: |
echo "currentImage=${{ steps.prep.outputs.image }}:${{ matrix.logstash-branch }}" >> $GITHUB_OUTPUT
- name: Validate config ☁️
run: docker run --rm -e "FILE_EXIT_AFTER_READ=false" ${{ steps.result.outputs.currentImage }} -t
#Publish on master
- name: Login to DockerHub 📦
if: ${{ github.ref_name == 'master' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to Docker repo (on Push only) ☁️
if: ${{ github.ref_name == 'master' }}
run: docker image push --all-tags ${{ steps.prep.outputs.image }}