Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions aiperf/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ FROM python:3.11-slim

# Install AIPerf for performance benchmarking
# Install Datadog for metrics export (Custom Metrics API)
#
# NOTE: these are intentionally unpinned upstream, so an image rebuilt tomorrow
# may not contain the same code as the one running today, and a compromised
# release would be pulled in automatically. Pinning requires resolving the exact
# versions against PyPI (`pip install aiperf==X.Y.Z datadog==A.B.C`), which needs
# network access this change does not have; recorded here as the next step.
RUN pip install --no-cache-dir aiperf datadog

WORKDIR /scripts
Expand All @@ -13,4 +19,14 @@ COPY common/ /scripts/common/
COPY aiperf/benchmark.py /scripts/benchmark.py
RUN chmod +x /scripts/benchmark.py

# The image ran as root: the benchmark needs no privileges, but any code-execution
# bug in it (or in a dependency) started as uid 0 inside the container, which is
# the precondition for most container escapes. A dedicated unprivileged account is
# created instead. The GID is matched by `fsGroup` in cronjob.yaml so the mounted
# results volume stays writable.
RUN groupadd --gid 10001 benchmark \
&& useradd --uid 10001 --gid 10001 --create-home --shell /usr/sbin/nologin benchmark \
&& chown -R benchmark:benchmark /scripts
USER 10001:10001

CMD ["python3", "/scripts/benchmark.py"]
Loading