forked from elastic/connectors
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.agent
35 lines (29 loc) · 1.66 KB
/
Dockerfile.agent
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
# This file is for internal experimental purposes only.
# Please do not use this file for any real-world workloads.
FROM docker.elastic.co/elastic-agent/elastic-agent:9.0.0-SNAPSHOT
USER root
# Install dependencies
RUN apt update
RUN apt install software-properties-common -y
RUN add-apt-repository ppa:deadsnakes/ppa
RUN apt install python3.11 python3.11-venv make -y
# TEMPORARY STUFF
# I need vim to edit some fields
# Git is needed to pull connectors repo
# yq is needed to append our input to elastic-agent.yml
RUN add-apt-repository ppa:rmescandon/yq
RUN apt install vim git yq -y
# Copy and install python agent client
# TODO: also package this with revision and everything
COPY ./ /usr/share/connectors
WORKDIR /usr/share/connectors
RUN PYTHON=python3.11 make clean install install-agent
# Add component
# Agent directory name is dynamic and based on build hash, so we need to move in two steps
COPY ./resources/agent/python-elastic-agent-client /tmp/python-elastic-agent-client
COPY ./resources/agent/python-elastic-agent-client.spec.yml /tmp/python-elastic-agent-client.spec.yml
RUN mv /tmp/python-elastic-agent-client /usr/share/elastic-agent/data/elastic-agent-$(cat /usr/share/elastic-agent/.build_hash.txt| cut -c 1-6)/components/python-elastic-agent-client
RUN mv /tmp/python-elastic-agent-client.spec.yml /usr/share/elastic-agent/data/elastic-agent-$(cat /usr/share/elastic-agent/.build_hash.txt| cut -c 1-6)/components/python-elastic-agent-client.spec.yml
# add input to the elastic-agent.yml
RUN yq eval --inplace '.inputs += { "type": "connectors-py", "id": "connectors-py", "use_output": "default"}' /usr/share/elastic-agent/elastic-agent.yml
WORKDIR /usr/share/elastic-agent