From 74b4d863db310a2d42dd706213c11dfd75a8dedc Mon Sep 17 00:00:00 2001 From: Issif Date: Wed, 11 May 2022 11:32:03 +0200 Subject: [PATCH] fix CI Signed-off-by: Issif --- .golangci.yml | 3 ++- .goreleaser.yml | 2 ++ Dockerfile | 16 ++-------------- Dockerfile.dev | 31 +++++++++++++++++++++++++++++++ Makefile | 6 ++++-- 5 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 Dockerfile.dev diff --git a/.golangci.yml b/.golangci.yml index 877c5e377..5fd67689b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,4 +22,5 @@ linters: include: - EXC0002 # include "missing comments" issues from golint max-issues-per-linter: 0 - max-same-issues: 0 \ No newline at end of file + max-same-issues: 0 + \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index 4cd5ca4f5..7a7496b56 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -149,6 +149,8 @@ docker_signs: release: github: + owner: falcosecurity + name: falcosidekick prerelease: auto extra_files: - glob: ./release/cosign.pub diff --git a/Dockerfile b/Dockerfile index fd9cf1c00..7c85d808b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,4 @@ -ARG BUILDER_IMAGE=golang:1.18-buster ARG BASE_IMAGE=alpine:3.15 - -FROM ${BUILDER_IMAGE} AS build-stage - -ENV CGO_ENABLED=0 - -WORKDIR /src/ -COPY . . - -RUN go get -RUN make falcosidekick - # Final Docker image FROM ${BASE_IMAGE} AS final-stage LABEL MAINTAINER "Thomas Labarussias " @@ -25,8 +13,8 @@ USER 1234 WORKDIR ${HOME}/app COPY LICENSE . -COPY --from=build-stage /src/falcosidekick . +COPY falcosidekick . EXPOSE 2801 -ENTRYPOINT ["./falcosidekick"] +ENTRYPOINT ["./falcosidekick"] \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000..ed945c474 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,31 @@ +ARG BUILDER_IMAGE=golang:1.18-buster +ARG BASE_IMAGE=alpine:3.15 + +FROM ${BUILDER_IMAGE} AS build-stage + +ENV CGO_ENABLED=0 + +WORKDIR /src/ +COPY . . + +RUN make falcosidekick + +# Final Docker image +FROM ${BASE_IMAGE} AS final-stage +LABEL MAINTAINER "Thomas Labarussias " + +RUN apk add --update --no-cache ca-certificates + +# Create user falcosidekick +RUN addgroup -S falcosidekick && adduser -u 1234 -S falcosidekick -G falcosidekick +# must be numeric to work with Pod Security Policies: +# https://kubernetes.io/docs/concepts/policy/pod-security-policy/#users-and-groups +USER 1234 + +WORKDIR ${HOME}/app +COPY LICENSE . +COPY --from=build-stage /src/falcosidekick . + +EXPOSE 2801 + +ENTRYPOINT ["./falcosidekick"] diff --git a/Makefile b/Makefile index 791be1e09..7fda4604d 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ TOOLS_BIN_DIR := $(abspath $(TOOLS_DIR)/bin) GO_INSTALL = ./hack/go_install.sh # Binaries. -GOLANGCI_LINT_VER := v1.44.2 +GOLANGCI_LINT_VER := v1.46.0 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) @@ -51,15 +51,17 @@ GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) .PHONY: falcosidekick falcosidekick: + $(GO) mod download $(GO) build -trimpath -ldflags "$(LDFLAGS)" -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o $@ . .PHONY: falcosidekick-linux-amd64 falcosidekick-linux-amd64: + $(GO) mod download GOOS=linux GOARCH=amd64 $(GO) build -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o falcosidekick . .PHONY: build-image build-image: falcosidekick-linux-amd64 - $(DOCKER) build . -t falcosecurity/falcosidekick:latest + $(DOCKER) build -t falcosecurity/falcosidekick:latest . ## -------------------------------------- ## Test