Skip to content

Commit 93d4a3d

Browse files
alacukupoiana
authored andcommitted
new(CI): build and push docker images when releasing a new version
Signed-off-by: Aldo Lacuku <[email protected]>
1 parent fc322ac commit 93d4a3d

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

.github/workflows/docker-image.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: docker-image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_call:
7+
8+
jobs:
9+
docker-image:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 #v2.1.0
19+
20+
- name: Set up Docker Buildx
21+
id: Buildx
22+
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 #v2.2.1
23+
24+
- name: Login to Docker Hub
25+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a #v2.1.0
26+
with:
27+
username: ${{ secrets.DOCKERHUB_USER }}
28+
password: ${{ secrets.DOCKERHUB_SECRET }}
29+
30+
- name: Docker Meta
31+
id: meta_falcoctl
32+
uses: docker/metadata-action@57396166ad8aefe6098280995947635806a0e6ea #v4.1.1
33+
with:
34+
# list of Docker images to use as base name for tags
35+
images: |
36+
docker.io/falcosecurity/falcoctl
37+
tags: |
38+
type=ref,event=branch
39+
type=semver,pattern={{ version }}
40+
41+
- name: Build and push
42+
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 #v3.2.0
43+
with:
44+
context: .
45+
platforms: linux/amd64,linux/arm64
46+
push: true
47+
tags: ${{ steps.meta_falcoctl.outputs.tags }}
48+
file: ./build/Dockerfile

.github/workflows/release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,6 @@ jobs:
3434
args: release --rm-dist
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
docker-image:
38+
uses: ./.github/workflows/docker-image.yaml
39+
secrets: inherit

.goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ snapshot:
4040
release:
4141
github:
4242
prerelease: auto
43+
mode: replace
4344

4445
changelog:
4546
use: github

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ GOBIN=$(shell go env GOBIN)
77
endif
88

99
GO ?= go
10+
DOCKER ?= docker
1011

1112
# version settings
1213
RELEASE?=$(shell git rev-parse --short HEAD)
@@ -68,3 +69,6 @@ endif
6869
# "--new-from-rev REV Show only new issues created after git revision REV"
6970
lint: golangci-lint
7071
$(GOLANGCILINT) run --new-from-rev main
72+
73+
docker:
74+
$(DOCKER) build -f ./build/Dockerfile .

build/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ ARG BIN_NAME="falcoctl"
1919
COPY --from=builder /tmp/builder/${BIN_NAME} /usr/bin/${BIN_NAME}
2020
RUN ln -s /usr/bin/${BIN_NAME} /usr/bin/falcoctl-bin
2121

22-
ENTRYPOINT [ "/usr/bin/falcoctl-bin" ]
22+
ENTRYPOINT [ "/usr/bin/falcoctl-bin" ]

0 commit comments

Comments
 (0)