-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (46 loc) · 1.63 KB
/
Dockerfile
File metadata and controls
60 lines (46 loc) · 1.63 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
# Main application image
FROM python:3.11-slim
LABEL maintainer="DFIR Community"
LABEL description="Automated malware capability analysis web service using capa"
# Install system dependencies including ClamAV
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
clamav \
clamav-daemon \
clamav-freshclam \
&& rm -rf /var/lib/apt/lists/*
# Update ClamAV virus database
RUN freshclam || true
WORKDIR /app
# Copy capa rules (will be cloned during build or mounted)
RUN git clone --depth 1 https://github.com/mandiant/capa-rules.git /app/rules
# Install Python dependencies
COPY capa-server/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Install capa
RUN pip install --no-cache-dir flare-capa
# Install badsign for YARA and ClamAV signature generation
COPY badsign/ /tmp/badsign/
RUN pip install --no-cache-dir /tmp/badsign && \
rm -rf /tmp/badsign
# Copy application code
COPY capa-server/app/ /app/app/
COPY capa-server/static/ /app/static/
# Create data directories
RUN mkdir -p /app/data/uploads /app/data/results && \
chmod 777 /app/data/uploads /app/data/results
# Environment variables
ENV CAPA_RULES_PATH=/app/rules \
DATABASE_PATH=/app/data/capa.db \
UPLOAD_DIR=/app/data/uploads \
RESULTS_DIR=/app/data/results \
MAX_FILE_SIZE_MB=100 \
PYTHONUNBUFFERED=1
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8080/health')" || exit 1
# Run application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]