Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (48 loc) · 1.75 KB
/
Copy pathDockerfile
File metadata and controls
64 lines (48 loc) · 1.75 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
# SPECTRA Docker Image [CLI-First & Headless Worker]
# ====================================================
# Multi-stage build for optimized image size
# Stage 1: Builder
FROM python:3.11-slim as builder
WORKDIR /tmp
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libmagic1 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN grep -v '^qdrant-client>=' requirements.txt > /tmp/requirements.osint-node.txt && \
pip install --no-cache-dir --user -r /tmp/requirements.osint-node.txt
# Stage 2: Runtime
FROM python:3.11-slim
LABEL maintainer="SWORD Intelligence"
LABEL version="1.0.0"
LABEL description="SPECTRA Forensic-Grade Intelligence & Archiving Platform"
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libmagic1 \
curl \
jq \
procps \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN groupadd -r spectra && useradd -r -g spectra -d /home/spectra -m spectra
# Set working directory
WORKDIR /app
# Copy Python dependencies from builder
COPY --from=builder /root/.local /home/spectra/.local
# Copy application code
COPY --chown=spectra:spectra . .
# Create necessary runtime directories
RUN mkdir -p /app/data /app/logs /app/config /app/media /app/checkpoints && \
chmod +x /app/spectra && \
chown -R spectra:spectra /app
# Set environment variables
ENV PATH="/home/spectra/.local/bin:/app:$PATH" \
PYTHONUNBUFFERED=1 \
SPECTRA_DEBUG=false
# Set user
USER spectra
# Healthcheck verifies worker process presence
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD pgrep -f "python" || exit 1
# Default entrypoint: Process Intelligence Queue
CMD ["./spectra", "process-queue"]