feat: update filebeat dockerfile to support arm v7 and v6 (armhf)

This commit is contained in:
RouxAntoine 2022-04-20 13:42:42 +02:00
parent c5736fa25b
commit afbfdd027f
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
3 changed files with 41 additions and 2 deletions

View File

@ -1,4 +1,23 @@
FROM golang:1.18.1-alpine3.15 as builder
ARG ELASTICSTACK_VERSION=8.1.2
FROM docker.elastic.co/beats/filebeat:${ELASTICSTACK_VERSION}
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"]

18
entrypoint.sh Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env sh
if [ -n "$ELASTICSEARCH_PASSWORD_FILE" ]; then
ELASTICSEARCH_PASSWORD=$(cat "$ELASTICSEARCH_PASSWORD_FILE");
export ELASTICSEARCH_PASSWORD;
fi
# Initialize kibana stuff related to metric and filebeat
filebeat setup --dashboards --index-management -e \
-E output.elasticsearch.hosts=["$ELASTICSEARCH_HOSTS"] \
-E output.elasticsearch.username="$ELASTICSEARCH_USERNAME" \
-E output.elasticsearch.password="$ELASTICSEARCH_PASSWORD" \
-E output.elasticsearch.ssl.verification_mode=none \
-E setup.kibana.host="$KIBANA_HOSTS" \
-E setup.kibana.ssl.verification_mode=none \
-c /usr/share/filebeat/filebeat.yml
exec "$@"

View File

@ -12,9 +12,11 @@ processors:
- add_cloud_metadata: ~
output.elasticsearch:
hosts: '${ELASTICSEARCH_HOSTS:elasticsearch:9200}'
hosts: '[${ELASTICSEARCH_HOSTS:elasticsearch:9200}]'
username: '${ELASTICSEARCH_USERNAME:}'
password: '${ELASTICSEARCH_PASSWORD:}'
ssl:
verification_mode: none
#filebeat.inputs:
# - type: container