FROM python:3.11-slim # Install system dependencies and masscan RUN apt-get update && \ apt-get install -y --no-install-recommends \ git \ build-essential \ libpcap-dev \ nmap \ chromium \ chromium-driver \ && rm -rf /var/lib/apt/lists/* # Build and install masscan from source RUN git clone https://github.com/robertdavidgraham/masscan /tmp/masscan && \ cd /tmp/masscan && \ make && \ make install && \ cd / && \ rm -rf /tmp/masscan # Set working directory WORKDIR /app # Copy requirements and install Python dependencies COPY app/requirements.txt . COPY app/requirements-web.txt . RUN pip install --no-cache-dir -r requirements.txt && \ pip install --no-cache-dir -r requirements-web.txt # Install Playwright browsers (Chromium only) # Note: We skip --with-deps since we already installed system chromium and dependencies above RUN playwright install chromium # Copy application code COPY app/src/ ./src/ COPY app/templates/ ./templates/ COPY app/web/ ./web/ COPY app/migrations/ ./migrations/ COPY app/alembic.ini . COPY app/init_db.py . # Create required directories RUN mkdir -p /app/output /app/logs # Make scripts executable RUN chmod +x /app/src/scanner.py /app/init_db.py # Force Python unbuffered output ENV PYTHONUNBUFFERED=1 # Expose Flask web app port EXPOSE 5000 # Default entry point is the scanner (backward compatibility) # To run the Flask web app, override with: docker run --entrypoint python3 sneakyscanner -m web.app # To initialize the database, use: docker run --entrypoint python3 sneakyscanner init_db.py ENTRYPOINT ["python3", "-u", "/app/src/scanner.py"] CMD ["--help"]