File size: 4,575 Bytes
71b8bb1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV RUSTUP_DIST_SERVER="https://static.rust-lang.org"
ENV RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
ENV CARGO_REGISTRIES_CRATES_IO_INDEX="sparse+https://index.crates.io/"
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
ENV GOPROXY="https://proxy.golang.org,direct"
ENV GOSUMDB=sum.golang.google.cn
ENV GOTOOLCHAIN=auto
ENV UV_INSECURE_HOST=""
ENV UV_INDEX_URL="https://pypi.org/simple"
ENV UV_CACHE_DIR=/workspace/.cache/uv
ENV npm_config_registry="https://registry.npmjs.org/"
ENV npm_config_strict_ssl=false
ENV npm_config_cache=/workspace/.cache/npm
ENV PIP_INDEX_URL="https://pypi.org/simple"
ENV PIP_TRUSTED_HOST=""
ENV HOME=/workspace
ENV XDG_CACHE_HOME=/workspace/.cache
ENV PIP_CACHE_DIR=/workspace/.cache/pip
ENV PYTHONUSERBASE=/workspace/.local
ENV PAGER=cat
ENV MANPAGER=cat
ENV LESS=-R
ENV TQDM_DISABLE=1
RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip autoconf automake gettext file binutils g++ libtool libncurses-dev meson ninja-build unzip wget curl xz-utils bzip2 zip zstd patch python3-pytest python3-pytest-xdist python3-coverage tar && rm -rf /var/lib/apt/lists/*
ARG CMAKE_VERSION=3.31.10
ARG CMAKE_PYPI_INDEX_URL=https://pypi.org/simple
RUN set -eux; python3 -m pip install --no-cache-dir --index-url "${CMAKE_PYPI_INDEX_URL}" --trusted-host "mirror.example.invalid" "cmake==${CMAKE_VERSION}"; cmake --version; ctest --version; cpack --version
COPY programgym-gcc13.tar.gz /tmp/gcc.tar.gz
ARG GCC_VERSION=13.3.0
RUN set -eux; ARCH="$(dpkg --print-architecture)"; case "${ARCH}" in amd64) GCC_ARCH="x64" ;; arm64) GCC_ARCH="arm64" ;; *) echo "unsupported architecture for GCC 13: ${ARCH}" >&2; exit 1 ;; esac; if [ "${GCC_ARCH}" != "x64" ]; then echo "the staged GCC 13 archive is for x64, got ${GCC_ARCH}" >&2; exit 1; fi; rm -rf /opt/gcc-13; mkdir -p /opt/gcc-13; tar -xzf /tmp/gcc.tar.gz --strip-components=1 -C /opt/gcc-13; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/gcc; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/g++; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/cc; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/c++; ln -sf /opt/gcc-13/bin/gcc /usr/local/bin/gcc-13; ln -sf /opt/gcc-13/bin/g++ /usr/local/bin/g++-13; for PROGRAMGYM_GCOV_TOOL in gcov gcov-dump gcov-tool; do if [ -x "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" ]; then ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/local/bin/${PROGRAMGYM_GCOV_TOOL}"; ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/local/bin/${PROGRAMGYM_GCOV_TOOL}-13"; ln -sf "/opt/gcc-13/bin/${PROGRAMGYM_GCOV_TOOL}" "/usr/bin/${PROGRAMGYM_GCOV_TOOL}"; fi; done; ln -sf /opt/gcc-13/bin/gcc /usr/bin/gcc; ln -sf /opt/gcc-13/bin/g++ /usr/bin/g++; ln -sf /opt/gcc-13/bin/gcc /usr/bin/cc; ln -sf /opt/gcc-13/bin/g++ /usr/bin/c++; rm -f /tmp/gcc.tar.gz; gcc --version; g++ --version; gcov --version; command -v gcov-dump >/dev/null && gcov-dump --version | head -n 1 || true
WORKDIR /workspace
ADD workspace.tar.gz /workspace/
COPY executable /workspace/executable
COPY download.sh /workspace/download.sh
RUN chmod 755 /workspace/download.sh
COPY harbor_prepare_download_env.sh /tmp/harbor_prepare_download_env.sh
RUN chmod 755 /tmp/harbor_prepare_download_env.sh \
 && /bin/bash /tmp/harbor_prepare_download_env.sh \
 && rm -f /workspace/download.sh \
 && rm -f /tmp/harbor_prepare_download_env.sh
ENV BASH_ENV=/etc/profile.d/programgym_download_env.sh
RUN chmod 111 /workspace/executable
WORKDIR /workspace
# Harbor uses tests/ as the separate verifier build context. Start with the
# same toolchain as the agent, then remove every cleanroom workspace artifact.
RUN rm -rf /workspace/* /workspace/.[!.]* 2>/dev/null || true \
 && mkdir -p /workspace /tests

# Synthetic cleanroom Dockerfiles commonly install Ubuntu's pytest-xdist 2.5.0.
# Installing a newer pytest alone leaves that apt package importable and creates
# an incompatible mixed apt/pip stack (xdist 2.5 imports the removed py.log).
# Install and constrain the verifier test runner as one coherent pip toolchain.
RUN printf 'pytest<9\n' > /etc/pip-constraint.txt
ENV PIP_CONSTRAINT=/etc/pip-constraint.txt
RUN python3 -m pip install --no-cache-dir --disable-pip-version-check \
    'pytest<9' 'pytest-xdist>=3,<4' pytest-rerunfailures pytest-timeout

COPY test.sh /tests/test.sh
COPY programgym_evaluator.py /tests/programgym_evaluator.py
COPY programgym_task.json /tests/programgym_task.json
COPY blobs/ /tests/blobs/
RUN chmod +x /tests/test.sh