-
Notifications
You must be signed in to change notification settings - Fork 7
45 lines (38 loc) · 1.35 KB
/
build-ingest-log4j-vulns.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
name: Build
on:
push:
branches:
- main
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v2
- name: Detect Dockerfile changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
projectchanged:
- 'ingest-log4j-vulns/**'
- name: Should Build?
if: steps.filter.outputs.projectchanged == 'true'
run: |
echo "Project changed. Need to update Docker image."
echo "need_docker_build=true" >> $GITHUB_ENV
- name: Login to DockerHub Registry
if: env.need_docker_build
run: echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin docker.io
- name: Build the latest Docker image
if: env.need_docker_build
run: |
cd ingest-log4j-vulns
pkgver="$(jq -r .version package.json)"
echo "pkgver=$pkgver" >> $GITHUB_ENV
docker build --file Dockerfile --tag jupiterone/ingest-log4j-vulns:latest --tag jupiterone/ingest-log4j-vulns:$pkgver .
- name: Push the latest Docker image
if: env.need_docker_build
run: |
docker push jupiterone/ingest-log4j-vulns:latest
docker push jupiterone/ingest-log4j-vulns:${{ env.pkgver }}