FROM python:3.11-bookworm
# Basic environment setup for building and running sqlmap from source
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
LANG=C.UTF-8
# Working directory inside the container
WORKDIR /app
# Install system dependencies required to build some bundled third-party libraries
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
ca-certificates \
build-essential \
libssl-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the repository contents into the image
COPY . .
# (Optional) Pre-compile Python sources to speed up startup
RUN python3 -m compileall -q .
# Ensure Python can find the project modules
ENV PYTHONPATH=/app:$PYTHONPATH
# Default command: display help for sqlmap when container starts without args
ENTRYPOINT ["python3", "sqlmap.py"]
CMD ["--help"]
# Ignore git, tests, and temporary files !.git .git/ __pycache__/ *.pyc *.swp *.swo *.tox *.eggs build/ dist/ *.egg-info/ __pycache__/ *.pytest_cache/ .ipynb_checkpoints/ .data/ .env .cache .venv
Concerns: No .dockerignore mentioned; copying the entire repo could bloat the image if the build context contains large or unnecessary files, Assumes sqlmap.py exists at the repository root; if the project layout differs, the COPY and ENTRYPOINT may fail during build, Relies on basic Python execution; if sqlmap has additional runtime dependencies or requires a virtual environment, further steps may be needed Smoke [PASS]: test -f /app/sqlmap.py Smoke [PASS]: python3 sqlmap.py --help