-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (100 loc) · 3.2 KB
/
docker.yaml
File metadata and controls
109 lines (100 loc) · 3.2 KB
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
name: Docker Build and Push
on:
workflow_dispatch:
push:
branches:
- 'main'
- '**dev'
tags:
- '*'
paths:
- 'src/**'
- 'docker/**'
release:
types: [ published ]
env:
GITHUB_CONTAINER_PREFIX: ghcr.io
DOCKER_IMAGE: WGErinys
jobs:
docker_build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITHUB_CONTAINER_PREFIX }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract Docker metadata from environment
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GITHUB_CONTAINER_PREFIX }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,format=short,prefix=
- name: Build and export Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
# Initialy disabled
# docker_scan:
# if: ${{ github.event_name != 'pull_request' }}
# runs-on: ubuntu-latest
# needs: docker_build
# steps:
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# registry: ${{ env.DOCKERHUB_PREFIX }}
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
#
# - name: Log in to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ${{ env.GITHUB_CONTAINER_PREFIX }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Docker Scout CVEs
# uses: docker/scout-action@v1
# with:
# command: cves
# image: ${{ env.GITHUB_CONTAINER_PREFIX }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE }}:main
# only-severities: critical,high
# only-fixed: true
# write-comment: true
# github-token: ${{ secrets.GITHUB_TOKEN }}
# exit-code: true
#
# - name: Docker Scout Compare
# uses: docker/scout-action@v1
# with:
# command: compare
# # Set to Github for maximum compat
# image: ${{ env.GITHUB_CONTAINER_PREFIX }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE }}:main
# to: ${{ env.GITHUB_CONTAINER_PREFIX }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE }}:latest
# only-severities: critical,high
# ignore-unchanged: true
# github-token: ${{ secrets.GITHUB_TOKEN }}