-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (43 loc) · 1.59 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (43 loc) · 1.59 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Kafka Performance Testing Container
# Includes Kafka CLI tools, Ansible, and Python dependencies for report generation
FROM ubuntu:22.04
LABEL maintainer="OSO DevOps"
LABEL description="Kafka Performance Testing Automation"
LABEL version="1.0"
# Install system dependencies and Java (required for Kafka CLI tools)
RUN apt-get update && apt-get install -y --no-install-recommends \
ansible \
python3 \
python3-pip \
python3-venv \
openjdk-17-jre-headless \
curl \
netcat \
&& rm -rf /var/lib/apt/lists/*
# Download and install Kafka CLI tools
ENV KAFKA_VERSION=3.5.1
ENV SCALA_VERSION=2.13
RUN curl -sL "https://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz" | tar -xz -C /opt && \
mv /opt/kafka_${SCALA_VERSION}-${KAFKA_VERSION} /opt/kafka
# Add Kafka binaries to PATH
ENV PATH="/opt/kafka/bin:$PATH"
ENV KAFKA_HOME="/opt/kafka"
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt .
# Create virtual environment and install Python dependencies
RUN python3 -m venv /opt/venv && \
/opt/venv/bin/pip install --no-cache-dir --upgrade pip && \
/opt/venv/bin/pip install --no-cache-dir -r requirements.txt
# Set virtual environment in PATH
ENV PATH="/opt/venv/bin:$PATH"
# Copy application files
COPY . .
# Set environment variables
ENV ANSIBLE_HOST_KEY_CHECKING=False
ENV ANSIBLE_RETRY_FILES_ENABLED=False
# Create results directory
RUN mkdir -p /app/results/raw_logs /app/results/parsed_data /app/results/reports
# Default command - show help
CMD ["ansible-playbook", "--help"]