Skip to content

Commit

Permalink
image: fix due the kafka lib we are using need a external library to …
Browse files Browse the repository at this point in the history
…work
  • Loading branch information
cpanato committed Dec 2, 2020
1 parent d85ef56 commit b1f7ffc
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Build image (Golang)
FROM golang:1.14-alpine AS build-stage
ENV GO111MODULE on
ENV CGO_ENABLED 0
ARG BUILDER_IMAGE=golang:1.15.5-alpine
ARG BASE_IMAGE=alpine:3.12

RUN apk add --no-cache gcc git make
FROM ${BUILDER_IMAGE} AS build-stage

RUN apk add --update --no-cache alpine-sdk ca-certificates librdkafka coreutils

WORKDIR /src
ADD . .

RUN go mod download
RUN go build -o falcosidekick
RUN go build -tags musl -gcflags all=-trimpath=/src -asmflags all=-trimpath=/src -a -installsuffix cgo -o falcosidekick .

# Final Docker image
FROM alpine AS final-stage
FROM ${BASE_IMAGE} AS final-stage
LABEL MAINTAINER "Thomas Labarussias <issif+falcosidekick@gadz.org>"

RUN apk add --no-cache ca-certificates
RUN apk add --update --no-cache ca-certificates librdkafka

# Create user falcosidekick
RUN addgroup -S falcosidekick && adduser -u 1234 -S falcosidekick -G falcosidekick
Expand All @@ -24,6 +24,7 @@ RUN addgroup -S falcosidekick && adduser -u 1234 -S falcosidekick -G falcosideki
USER 1234

WORKDIR ${HOME}/app
COPY --from=build-stage /src/LICENSE .
COPY --from=build-stage /src/falcosidekick .

EXPOSE 2801
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GOPROXY := https://proxy.golang.org
endif
export GOPROXY
GO ?= go
DOCKER ?= docker
TEST_FLAGS ?= -v -race

# Directories.
Expand All @@ -33,6 +34,10 @@ GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
falcosidekick:
$(GO) build -o $@

.PHONY: build-image
build-image:
$(DOCKER) build . -t falcosecurity/falcosidekick:latest

## --------------------------------------
## Test
## --------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/Azure/azure-event-hubs-go/v3 v3.3.3
github.com/DataDog/datadog-go v4.2.0+incompatible
github.com/aws/aws-sdk-go v1.35.30
github.com/confluentinc/confluent-kafka-go v1.5.2 // indirect
github.com/confluentinc/confluent-kafka-go v1.5.2
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21
github.com/emersion/go-smtp v0.14.0
github.com/nats-io/nats.go v1.10.0
Expand All @@ -17,5 +17,4 @@ require (
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58
google.golang.org/api v0.35.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/confluentinc/confluent-kafka-go.v1 v1.5.2
)
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,6 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/confluentinc/confluent-kafka-go.v1 v1.5.2 h1:g0WBLy6fobNUU8W/e9zx6I0Yl79Ya+BDW1NwzAlTiiQ=
gopkg.in/confluentinc/confluent-kafka-go.v1 v1.5.2/go.mod h1:ZdI3yfYmdNSLQPNCpO1y00EHyWaHG5EnQEyL/ntAegY=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
Expand Down
3 changes: 2 additions & 1 deletion outputs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import (
"cloud.google.com/go/pubsub"
"github.com/DataDog/datadog-go/statsd"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/confluentinc/confluent-kafka-go/kafka"

"github.com/falcosecurity/falcosidekick/types"
"gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"
)

// ErrHeaderMissing = 400
Expand Down
3 changes: 2 additions & 1 deletion outputs/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"log"

"github.com/DataDog/datadog-go/statsd"
"github.com/confluentinc/confluent-kafka-go/kafka"

"github.com/falcosecurity/falcosidekick/types"
"gopkg.in/confluentinc/confluent-kafka-go.v1/kafka"
)

// NewKafkaClient returns a new output.Client for accessing the Apache Kafka.
Expand Down

0 comments on commit b1f7ffc

Please sign in to comment.