FROM python:3.11-slim
ENV PYTHONUNBUFFERED=1
# Install essential build tools and libraries (best-effort for various Python deps)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libxml2-dev \
libxslt1-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /opt/sqlmap
# Copy the repository contents
COPY . .
# Upgrade pip and install optional requirements if present
RUN python -m pip install --upgrade pip
RUN if [ -f requirements.txt ]; then python -m pip install --no-cache-dir -r requirements.txt; fi
# Ensure the main script is executable
RUN chmod +x sqlmap.py
# Default command: run the smoke test
CMD ["python","sqlmap.py","--smoke"]
__pycache__/ *.pyc *.pyo *.pyd build/ dist/ *.egg-info/ *.egg-info .eggs/ *.log **/__pycache__/ vendor/ node_modules/ .DS_Store .git/
Concerns: COPY . . may copy unnecessary files into the image; consider adding a .dockerignore to reduce context size and image layers, If requirements.txt is large or missing, dependency installation might fail or produce inconsistent environments; ensure requirements are properly pinned and optional dependencies are handled, The smoke test relies on sqlmap.py having a --smoke flag and being executable; ensure compatibility across environments Smoke [PASS]: test -x /opt/sqlmap/sqlmap.py Smoke [PASS]: python --version Smoke [PASS]: python sqlmap.py --smoke