-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathbenthos-collector.Dockerfile
48 lines (28 loc) · 1.21 KB
/
benthos-collector.Dockerfile
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
FROM --platform=$BUILDPLATFORM golang:1.24.0-alpine3.21@sha256:2d40d4fc278dad38be0777d5e2a88a2c6dee51b0b29c97a764fc6c6a11ca893c AS builder
RUN apk add --update --no-cache ca-certificates make git curl
ARG TARGETPLATFORM
WORKDIR /src
ARG GOPROXY
ENV CGO_ENABLED=0
ENV GOCACHE=/go/cache
ENV GOMODCACHE=/go/pkg/mod
COPY --link go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/go/cache \
go mod download -x
ARG VERSION
COPY --link . .
RUN chmod +x entrypoint.sh
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/go/cache \
go build -ldflags "-X main.version=${VERSION}" -o /usr/local/bin/benthos ./cmd/benthos-collector
FROM alpine:3.21.3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c
RUN apk add --update --no-cache ca-certificates tzdata bash
SHELL ["/bin/bash", "-c"]
# This is so we can reuse presets in development
WORKDIR /etc/benthos
COPY cloudevents.spec.json /etc/benthos/
COPY collector/benthos/presets /etc/benthos/presets
COPY --link --from=builder /usr/local/bin/benthos /usr/local/bin/
COPY --link --from=builder /src/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh", "/usr/local/bin/benthos"]