forked from falcosecurity/falcoctl
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (91 loc) · 3.21 KB
/
docker-image.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
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
name: docker-image
on:
workflow_call:
inputs:
release:
required: true
type: string
commit:
required: true
type: string
build_date:
required: true
type: string
sign:
required: false
default: false
type: boolean
outputs:
digest:
description: The digest of the pushed image.
value: ${{ jobs.docker-image.outputs.digest }}
permissions:
contents: read
id-token: write
jobs:
docker-image:
runs-on: ubuntu-22.04
outputs:
image: ${{ steps.build-and-push.outputs.image }}
digest: ${{ steps.build-and-push.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee # v3.1.0
- name: Set up Docker Buildx
id: Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
- name: Login to Docker Hub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_SECRET }}
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: arn:aws:iam::292999226676:role/github_actions-falcoctl-ecr
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
with:
registry-type: public
- name: Docker Meta
id: meta_falcoctl
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
# list of Docker images to use as base name for tags
images: |
docker.io/falcosecurity/falcoctl
public.ecr.aws/falcosecurity/falcoctl
tags: |
type=ref,event=branch
type=semver,pattern={{ version }}
type=semver,pattern={{ major }}
type=semver,pattern={{ major }}.{{ minor }}
- name: Build and push
id: build-and-push
uses: docker/build-push-action@1ca370b3a9802c92e886402e0dd88098a2533b12 # v6.4.1
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta_falcoctl.outputs.tags }}
file: ./build/Dockerfile
build-args: |
RELEASE=${{ inputs.release }}
COMMIT=${{ inputs.commit }}
BUILD_DATE=${{ inputs.build_date }}
- name: Install Cosign
if: ${{ inputs.sign }}
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
- name: Sign the images with GitHub OIDC Token
if: ${{ inputs.sign }}
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
TAGS: ${{ steps.meta_falcoctl.outputs.tags }}
COSIGN_YES: "true"
run: echo "${TAGS}" | xargs -I {} cosign sign {}@${DIGEST}