-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
48 lines (37 loc) · 1.04 KB
/
Dockerfile.backend
File metadata and controls
48 lines (37 loc) · 1.04 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
FROM python:3.11-slim
# Install system dependencies including tcpreplay
RUN apt-get update && apt-get install -y \
tcpreplay \
tcpdump \
libpcap-dev \
gcc \
python3-dev \
libmagic1 \
libmagic-dev \
file \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY backend/requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY backend/ .
# Copy VERSION file from project root
COPY VERSION .
# Create necessary directories
RUN mkdir -p /tmp/pcap_uploads /var/log
# Set environment variables
ENV PYTHONPATH=/app
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV UPLOAD_FOLDER=/tmp/pcap_uploads
ENV LOG_FILE=/var/log/pcap_replaya.log
# Expose port
EXPOSE 5000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:5000/api/health')" || exit 1
# Run the application
CMD ["python", "app.py"]