mirror of
https://github.com/20kaushik02/real-time-traffic-analysis-clickhouse.git
synced 2025-12-06 08:14:07 +00:00
Incomplete - dockerizing kafka streaming
This commit is contained in:
parent
5ade3d90fc
commit
35881893f6
20
preprocessing/Dockerfile.python
Normal file
20
preprocessing/Dockerfile.python
Normal file
@ -0,0 +1,20 @@
|
||||
# Start with a base image that includes Python
|
||||
FROM python:3.9-slim
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy only the requirements.txt file to the container
|
||||
COPY requirements.txt /app
|
||||
|
||||
# Install the dependencies using the requirements.txt file
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy only the pcap_processor.py file to the container
|
||||
COPY pcap_processor.py /app
|
||||
|
||||
# Expose the port Kafka uses (optional, for communication with other services)
|
||||
EXPOSE 9092
|
||||
|
||||
# Command to run your Python application
|
||||
CMD ["python", "pcap_processor.py"]
|
||||
@ -14,6 +14,7 @@ dbg_print = lambda *x: DEBUG and print(f"[DEBUG] {x}")
|
||||
# Kafka Configuration
|
||||
KAFKA_TOPIC = 'pcap_stream'
|
||||
KAFKA_SERVER = 'localhost:9092' # Adjust to your Kafka server
|
||||
#KAFKA_SERVER = 'kafka_service:9092'
|
||||
|
||||
# Initialize Kafka Producer
|
||||
producer = KafkaProducer(
|
||||
|
||||
2
preprocessing/requirements.txt
Normal file
2
preprocessing/requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
kafka-python
|
||||
scapy
|
||||
Loading…
x
Reference in New Issue
Block a user