-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
72 lines (55 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
72 lines (55 loc) · 1.82 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Multi-stage build for Python gRPC application
# Supports both metric-agent and file-agent via AGENT_MODE env var
FROM python:3.11-slim as builder
# Set working directory
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy and merge requirements from both agents
COPY metric-agent/requirements.txt ./requirements-metric.txt
COPY file-agent/requirements.txt ./requirements-file.txt
# Combine and deduplicate requirements
RUN cat requirements-metric.txt requirements-file.txt | sort -u > requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir --user -r requirements.txt
FROM python:3.11-slim as production
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
iputils-ping \
iproute2 \
net-tools \
iperf3 \
dnsutils \
&& rm -rf /var/lib/apt/lists/*
# Copy Python packages from builder
COPY --from=builder /root/.local /root/.local
# Add local bin to PATH
ENV PATH=/root/.local/bin:$PATH
# Copy both agents
COPY metric-agent/ ./metric-agent/
COPY file-agent/ ./file-agent/
# Create necessary directories
RUN mkdir -p /topology \
/app/file-agent/send-file \
/app/file-agent/receive-file \
/app/file-agent/relay-cache
# Metric agent settings
ENV GRPC_TARGET=192.168.100.10:50051
ENV INTERVAL_SEC=5
ENV RETRY_BACKOFF_SEC=2
ENV MAX_BACKOFF_SEC=30
ENV TOPOLOGY_FILE=/topology/topology.json
# File agent settings
ENV NODE_HOST=0.0.0.0
ENV NODE_PORT=7000
ENV HEURISTIC_ADDR=192.168.100.3:50052
ENV TIMELINE_BACKEND_URL=192.168.100.10:50053
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose file agent port
EXPOSE 7000
# Use entrypoint to run both agents
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]