feat: migrate to debian as base image to prevent armv6 dns resolution error

This commit is contained in:
RouxAntoine 2022-04-21 18:39:53 +02:00
parent afbfdd027f
commit 238d1dedea
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
2 changed files with 35 additions and 25 deletions

View File

@ -1,23 +1,27 @@
FROM golang:1.18.1-alpine3.15 as builder FROM golang:1.18.1-bullseye as builder
ARG ELASTICSTACK_VERSION=8.1.2 ARG ELASTICSTACK_VERSION=8.1.2
WORKDIR /build 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" 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/ && \ RUN cd beats/filebeat/ && \
make make
FROM debian:bullseye-slim
FROM alpine:3.15
COPY --chown=root:filebeat filebeat.yml /usr/share/filebeat/filebeat.yml 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 --from=builder /build/beats/filebeat/filebeat /usr/local/bin/filebeat
COPY --chmod=750 entrypoint.sh /entrypoint.sh COPY --chmod=750 entrypoint.sh /entrypoint.sh
ENV ELASTICSEARCH_HOSTS=""
ENV ELASTICSEARCH_USERNAME=""
ENV ELASTICSEARCH_PASSWORD_FILE=""
ENV KIBANA_HOSTS=""
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["filebeat", "-e", "--strict.perms=false", "-c", "/usr/share/filebeat/filebeat.yml"] CMD ["filebeat", "-e", "--strict.perms=false", "-c", "/usr/share/filebeat/filebeat.yml"]

View File

@ -10,6 +10,28 @@ filebeat.autodiscover:
processors: processors:
- add_cloud_metadata: ~ - add_cloud_metadata: ~
- add_locale:
format: offset
- add_docker_metadata:
host: "unix:///var/run/docker.sock"
- add_host_metadata: ~
- decode_json_fields:
fields: ["message"]
target: "json"
overwrite_keys: true
setup:
kibana:
host: '${KIBANA_HOSTS:kibana:5601}'
ssl:
verification_mode: none
template:
enabled: true
name: "filebeat-%{[agent.version]}"
pattern: "index-%{[beat.version]}-*"
dashboards:
enabled: false
#index: "filebeat-%{[agent.version]}-*"
output.elasticsearch: output.elasticsearch:
hosts: '[${ELASTICSEARCH_HOSTS:elasticsearch:9200}]' hosts: '[${ELASTICSEARCH_HOSTS:elasticsearch:9200}]'
@ -17,25 +39,9 @@ output.elasticsearch:
password: '${ELASTICSEARCH_PASSWORD:}' password: '${ELASTICSEARCH_PASSWORD:}'
ssl: ssl:
verification_mode: none verification_mode: none
indices:
- index: "filebeat-%{[agent.version]}-%{[container.name]:common}-%{+yyyy.MM.dd}"
#filebeat.inputs:
# - type: container
# paths:
# - '/var/lib/docker/containers/*/*.log'
#
#processors:
# - add_docker_metadata:
# host: "unix:///var/run/docker.sock"
#
# - decode_json_fields:
# fields: ["message"]
# target: "json"
# overwrite_keys: true
#
#output.elasticsearch:
# hosts: ["elasticsearch:9200"]
# indices:
# - index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}"
#
#logging.json: true #logging.json: true
#logging.metrics.enabled: false #logging.metrics.enabled: false