# awspt — bundles Python engines + nmap + nuclei in one reproducible image.
FROM python:3.12-slim

# System tools: nmap (active port scan), nuclei (Go binary, installed below),
# plus build basics some engine deps need.
RUN apt-get update \
    && apt-get install -y --no-install-recommends nmap ca-certificates curl unzip \
    && rm -rf /var/lib/apt/lists/*

# nuclei (ProjectDiscovery) — install latest release binary.
ARG NUCLEI_VERSION=3.3.7
RUN arch="$(dpkg --print-architecture)" \
    && case "$arch" in amd64) na=amd64 ;; arm64) na=arm64 ;; *) na=amd64 ;; esac \
    && curl -sSfL "https://github.com/projectdiscovery/nuclei/releases/download/v${NUCLEI_VERSION}/nuclei_${NUCLEI_VERSION}_linux_${na}.zip" -o /tmp/nuclei.zip \
    && unzip -o /tmp/nuclei.zip -d /usr/local/bin nuclei \
    && rm /tmp/nuclei.zip \
    && nuclei -version || true

WORKDIR /app
COPY pyproject.toml README.md ./
COPY awspt ./awspt

# Install awspt plus the Python engines (prowler, scoutsuite, principalmapper).
RUN pip install --no-cache-dir ".[engines]"

# Pre-download nuclei templates so first run is fast (best-effort).
RUN nuclei -update-templates || true

WORKDIR /work
ENTRYPOINT ["awspt"]
CMD ["--help"]
