dannylev123's picture
SWE-Race v0.1 public split (95 tasks)
4e3f22a verified
Raw History Blame Contribute Delete
2.97 kB
# SWE-Race agent environment for aws__aws-advanced-python-wrapper-1089
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update -qq \
&& apt-get install -y -qq git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# One RUN, so no image layer ever holds the future history. In order:
# 1. Full clone, checked out at the base commit. The install needs the tags:
# setuptools_scm and hatch-vcs derive the version from them, and a shallow
# "0.1.dev1" build made pytest's own repo refuse to run its tests.
# 2. The task's setup (dependency install), exactly as verified.
# It is base64 so its quoting, newlines and comments survive verbatim.
# 3. Seal: drop the remote, every other ref and every tag; mark what the install
# created as ignored, so an agent's `git add -A` cannot sweep build artefacts
# into its submission; then graft HEAD as shallow and prune, leaving it the
# only reachable commit. HEAD keeps its upstream hash, which grader.py and
# pre_artifacts.sh diff against.
# /repo -> /app: The setup scripts (and `pip install -e /repo`) use /repo, while
# Harbor's convention and grader.py's default APP_DIR is /app.
ARG BASE_SHA=26cfe23985106e7cda32c80458f38d67a0d1e9e9
RUN ln -sfn /app /repo \
&& git clone -q https://github.com/aws/aws-advanced-python-wrapper . \
&& DEFAULT="$(git rev-parse --abbrev-ref origin/HEAD | sed 's|^origin/||')" \
&& DEFAULT="${DEFAULT:-main}" \
&& (git cat-file -e "$BASE_SHA^{commit}" 2>/dev/null || git fetch -q origin "$BASE_SHA") \
&& git checkout -q -B "$DEFAULT" "$BASE_SHA" \
&& (git submodule update --init --recursive || true) \
&& echo c2V0IC1ldXgKY2QgL3JlcG8KcHl0aG9uIC1tIHBpcCBpbnN0YWxsIC0tdXBncmFkZSBwaXAKcHl0aG9uIC1tIHBpcCBpbnN0YWxsIC1lIC4gcHl0ZXN0IHB5dGVzdC1tb2NrIFNRTEFsY2hlbXkgcHN5Y29wZyBwc3ljb3BnLWJpbmFyeQo= | base64 -d > /tmp/benchgen_setup.sh \
&& bash -euxo pipefail /tmp/benchgen_setup.sh \
&& rm -f /tmp/benchgen_setup.sh \
&& git remote remove origin \
&& git for-each-ref --format='%(refname)' | grep -vx "refs/heads/$DEFAULT" | xargs -r -n1 git update-ref -d \
&& git ls-files --others --exclude-standard >> .git/info/exclude \
&& git rev-parse HEAD > .git/shallow \
&& git reflog expire --expire=now --all \
&& git gc -q --prune=now
# Dev-workflow hooks would block the agent's commits; disable them.
RUN git config core.hooksPath /dev/null
# Services the tests need (Postgres, Redis) were started during the build above,
# which does not survive into a running container. Their data does, so restarting
# the daemon is enough: test.sh runs this before pytest, and the entrypoint runs it
# for the agent's session.
RUN echo IyEvYmluL2Jhc2gK | base64 -d > /usr/local/bin/benchgen-services \
&& printf '#!/bin/bash\n/usr/local/bin/benchgen-services >/dev/null 2>&1\nexec "$@"\n' > /usr/local/bin/benchgen-entry \
&& chmod +x /usr/local/bin/benchgen-services /usr/local/bin/benchgen-entry
ENTRYPOINT ["/usr/local/bin/benchgen-entry"]
CMD ["/bin/bash"]