# Build Sherlock from source and run
FROM python:3.12-slim-bullseye
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libffi-dev \
libxml2-dev \
libxslt1-dev \
ca-certificates \
git \
curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /sherlock
# Copy source code
COPY . .
# Upgrade pip and install the package from source
RUN python -m pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir .
ENV SHERLOCK_ENV=docker
ENTRYPOINT ["sherlock"]
# Ignore VCS and build outputs .git .gitignore __pycache__/ *.pyc *.pyo *.pyd build/ dist/ *.egg-info/ *.egg-info *.tox/ *.venv/ venv/ .env .env.collect __pycache__/ # Ignore runtime artifacts .sheri *.sqlite *.log # Node modules and frontend build outputs commonly present in repos node_modules/ frontend/node_modules/ # Documentation build outputs docs/_build/
Concerns: COPY . . may copy extraneous files into the build context; consider adding a .dockerignore to keep the build context small. Smoke [PASS]: sherlock --version Smoke [PASS]: sherlock --help Smoke [PASS]: command -v sherlock