FROM golang:1.18.1-alpine3.15 as builder ARG ELASTICSTACK_VERSION=8.1.2 WORKDIR /build ENV GOMAXPROCS="4" RUN apk update RUN apk add git bash make gcc musl-dev binutils-gold RUN git clone --single-branch --branch="v${ELASTICSTACK_VERSION}" --depth=1 https://github.com/elastic/beats.git RUN cd beats/filebeat/ && \ make FROM alpine:3.15 COPY --chown=root:filebeat filebeat.yml /usr/share/filebeat/filebeat.yml COPY --chmod=750 --from=builder /build/beats/filebeat/filebeat /usr/local/bin/filebeat COPY --chmod=750 entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["filebeat", "-e", "--strict.perms=false", "-c", "/usr/share/filebeat/filebeat.yml"]