-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (50 loc) · 1.48 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (50 loc) · 1.48 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
# Network Pinpointer - Production Docker Image
FROM python:3.11-slim
LABEL maintainer="Network Pinpointer Contributors"
LABEL description="Semantic network diagnostic tool using LJPW framework"
LABEL version="1.0.0"
# Install system dependencies
RUN apt-get update && apt-get install -y \
tcpdump \
net-tools \
iputils-ping \
curl \
&& rm -rf /var/lib/apt/lists/*
# Create app directory
WORKDIR /app
# Copy requirements first (for better caching)
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir \
influxdb-client \
prometheus-client \
redis \
psycopg2-binary \
fastapi \
uvicorn \
python-multipart
# Copy application code
COPY network_pinpointer/ ./network_pinpointer/
COPY pinpoint ./pinpoint
COPY test_semantic_imbuing.py ./
# Create necessary directories
RUN mkdir -p /app/config /app/data /app/captures /app/logs
# Make pinpoint executable
RUN chmod +x ./pinpoint
# Create non-root user for security
RUN useradd -m -u 1000 netpin && \
chown -R netpin:netpin /app
# Switch to non-root user
USER netpin
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Expose API port
EXPOSE 8080
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
LOG_LEVEL=info
# Start application
CMD ["python", "-m", "network_pinpointer.api_server"]