Marquis03's picture
commit
2e7d4b5 verified
Raw History Blame Contribute Delete
3.71 kB
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 python3-dev autoconf automake gettext file binutils libtool libncurses-dev meson ninja-build python3-pytest python3-pytest-xdist python3-coverage && 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
# programgym_quota_aware_nproc=1
RUN set -eux; printf '%s\n' '#!/bin/sh' 'if [ "$#" -gt 0 ]; then exec /usr/bin/nproc "$@"; fi' 'visible="$(/usr/bin/nproc)"' 'quota=""' 'period=""' 'if [ -r /sys/fs/cgroup/cpu.max ]; then' ' set -- $(cat /sys/fs/cgroup/cpu.max)' ' quota="${1:-}"' ' period="${2:-}"' 'elif [ -r /sys/fs/cgroup/cpu/cpu.cfs_quota_us ] && [ -r /sys/fs/cgroup/cpu/cpu.cfs_period_us ]; then' ' quota="$(cat /sys/fs/cgroup/cpu/cpu.cfs_quota_us)"' ' period="$(cat /sys/fs/cgroup/cpu/cpu.cfs_period_us)"' fi 'if [ -n "$quota" ] && [ "$quota" != max ] && [ "$quota" -gt 0 ] 2>/dev/null && [ "$period" -gt 0 ] 2>/dev/null; then' ' limit=$(( (quota + period - 1) / period ))' ' if [ "$limit" -lt 1 ]; then limit=1; fi' ' if [ "$limit" -lt "$visible" ]; then visible="$limit"; fi' fi 'printf "%s\n" "$visible"' > /usr/local/bin/nproc; chmod 0755 /usr/local/bin/nproc; /usr/local/bin/nproc >/dev/null
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 synthetic ProgramGym adapter: run the agent as an unprivileged user.
# Keep tool/runtime state under /home/agent and reserve /workspace for the
# submission handed to the separate verifier. Keep the reference executable
# execute-only; the oracle temporarily restores owner read permission.
RUN id -u agent >/dev/null 2>&1 || useradd -m -s /bin/bash agent
RUN mkdir -p /home/agent \
&& chown -R agent:agent /home/agent /workspace \
&& chown agent:agent /workspace/executable \
&& chmod 111 /workspace/executable
ENV HOME=/home/agent
WORKDIR /workspace
RUN ["bash","-lc","rm -f -- /workspace/download.sh /tmp/programgym-download.sh /tmp/download.sh /workspace/reference/build.sh && rm -rf -- /workspace/.programgym_build_env"]