docker-filebeat/Dockerfile

30 lines
942 B
Docker

FROM golang:1.18.1-bullseye as builder
ARG ELASTICSTACK_VERSION=8.1.2
WORKDIR /build
RUN apt update && apt upgrade -y
RUN git clone --single-branch --branch="v${ELASTICSTACK_VERSION}" --depth=1 https://github.com/elastic/beats.git
ENV GOMAXPROCS="4"
RUN cd beats/filebeat/ && \
make
FROM debian:bullseye-slim
COPY --chmod=750 --from=builder /build/beats/filebeat/filebeat /usr/local/bin/filebeat
COPY --chown=root:filebeat filebeat-docker.yml /usr/share/filebeat/filebeat-docker.yml
COPY --chown=root:filebeat filebeat-kubernetes.yml /usr/share/filebeat/filebeat-kubernetes.yml
COPY --chmod=750 entrypoint.sh /entrypoint.sh
# discovery mode could be docker or kubernetes
ENV DISCOVERY_MODE="docker"
ENV ELASTICSEARCH_HOSTS=""
ENV ELASTICSEARCH_USERNAME=""
ENV ELASTICSEARCH_PASSWORD_FILE=""
ENV KIBANA_HOSTS=""
ENTRYPOINT ["/entrypoint.sh"]
CMD filebeat -e --strict.perms=false -c /usr/share/filebeat/filebeat-$DISCOVERY_MODE.yml