-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 2.42 KB
/
docker_image_ci.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
name: Docker Image CI
on:
- workflow_dispatch # manual trigger
- push
jobs:
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- component: cnit_ml
version: version3
context: version3
title: CNIT ML (Machine Learning)
description: "Detects multiple DDoS attacks (multiclass) using Random Forests."
url: https://github.com/guard-project/cnit_ml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Repo metadata
id: repo
uses: actions/github-script@v3
with:
script: |
const repo = await github.repos.get(context.repo)
return repo.data
- name: Prepare
id: prep
run: |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
echo ::set-output name=branch::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ${{ matrix.context }}
file: ${{ matrix.context }}/Dockerfile
build-args: |
VERSION=${{ matrix.version }}
no-cache: true
push: true
tags: guardproject/${{ matrix.component }}:${{ matrix.version }}
labels: |
org.opencontainers.image.title=${{ matrix.title }}
org.opencontainers.image.description=${{ matrix.description }}
org.opencontainers.image.url=${{ matrix.url }}
org.opencontainers.image.source=${{ fromJson(steps.repo.outputs.result).html_url }}/tree/${{ steps.prep.outputs.branch }}/${{ matrix.context }}
org.opencontainers.image.version=${{ matrix.version }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ fromJson(steps.repo.outputs.result).license.spdx_id }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}