Marquis03's picture
commit (part 4)
02bbe23 verified
Raw History Blame Contribute Delete
6.27 kB
FROM ubuntu:24.04
ARG PROGRAMGYM_APT_REPOSITORY_BASE_URL=""
ARG PROGRAMGYM_GOPROXY="https://proxy.golang.org,direct"
ARG PROGRAMGYM_GOSUMDB="sum.golang.org"
ARG PROGRAMGYM_NPM_REGISTRY="https://registry.npmjs.org/"
ARG PROGRAMGYM_NPM_STRICT_SSL="true"
ARG PROGRAMGYM_PYPI_INDEX_URL="https://pypi.org/simple"
ARG PROGRAMGYM_PYPI_TRUSTED_HOST=""
ARG PROGRAMGYM_UV_INSECURE_HOST=""
ARG PROGRAMGYM_RUSTUP_DIST_SERVER="https://static.rust-lang.org"
ARG PROGRAMGYM_RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup"
ARG PROGRAMGYM_CARGO_INDEX="sparse+https://index.crates.io/"
ARG PROGRAMGYM_CARGO_NET_RETRY="10"
ARG PROGRAMGYM_CARGO_HTTP_TIMEOUT="600"
ARG PROGRAMGYM_CARGO_HTTP_MULTIPLEXING="false"
ARG PROGRAMGYM_MAVEN_MIRROR_URL=""
ARG PROGRAMGYM_GRADLE_PLUGIN_REPOSITORY_URL=""
ARG PROGRAMGYM_GRADLE_DISTRIBUTION_BASE_URL="https://services.gradle.org/distributions"
ARG PROGRAMGYM_JITPACK_REPOSITORY_URL="https://jitpack.io"
ENV GOPROXY=${PROGRAMGYM_GOPROXY}
ENV GOSUMDB=${PROGRAMGYM_GOSUMDB}
ENV PIP_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
ENV PIP_TRUSTED_HOST=${PROGRAMGYM_PYPI_TRUSTED_HOST}
ENV UV_INDEX_URL=${PROGRAMGYM_PYPI_INDEX_URL}
ENV UV_INSECURE_HOST=${PROGRAMGYM_UV_INSECURE_HOST}
ENV npm_config_registry=${PROGRAMGYM_NPM_REGISTRY}
ENV npm_config_strict_ssl=${PROGRAMGYM_NPM_STRICT_SSL}
ENV RUSTUP_DIST_SERVER=${PROGRAMGYM_RUSTUP_DIST_SERVER}
ENV RUSTUP_UPDATE_ROOT=${PROGRAMGYM_RUSTUP_UPDATE_ROOT}
ENV CARGO_REGISTRIES_CRATES_IO_INDEX=${PROGRAMGYM_CARGO_INDEX}
ENV CARGO_NET_RETRY=${PROGRAMGYM_CARGO_NET_RETRY}
ENV CARGO_HTTP_TIMEOUT=${PROGRAMGYM_CARGO_HTTP_TIMEOUT}
ENV CARGO_HTTP_MULTIPLEXING=${PROGRAMGYM_CARGO_HTTP_MULTIPLEXING}
ENV PROGRAMGYM_MAVEN_MIRROR_URL=${PROGRAMGYM_MAVEN_MIRROR_URL}
ENV PROGRAMGYM_GRADLE_PLUGIN_REPOSITORY_URL=${PROGRAMGYM_GRADLE_PLUGIN_REPOSITORY_URL}
ENV PROGRAMGYM_GRADLE_DISTRIBUTION_BASE_URL=${PROGRAMGYM_GRADLE_DISTRIBUTION_BASE_URL}
ENV PROGRAMGYM_JITPACK_REPOSITORY_URL=${PROGRAMGYM_JITPACK_REPOSITORY_URL}
COPY harbor_configure_apt_mirror.sh /tmp/harbor_configure_apt_mirror.sh
RUN chmod 0755 /tmp/harbor_configure_apt_mirror.sh \
&& /bin/bash /tmp/harbor_configure_apt_mirror.sh "${PROGRAMGYM_APT_REPOSITORY_BASE_URL}" \
&& rm -f /tmp/harbor_configure_apt_mirror.sh
COPY harbor_configure_java_mirrors.sh /tmp/harbor_configure_java_mirrors.sh
RUN chmod 0755 /tmp/harbor_configure_java_mirrors.sh \
&& /bin/bash /tmp/harbor_configure_java_mirrors.sh "${PROGRAMGYM_MAVEN_MIRROR_URL}" "${PROGRAMGYM_GRADLE_PLUGIN_REPOSITORY_URL}" "${PROGRAMGYM_JITPACK_REPOSITORY_URL}" \
&& rm -f /tmp/harbor_configure_java_mirrors.sh
ENV DEBIAN_FRONTEND=noninteractive
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
ENV GOTOOLCHAIN=auto
ENV UV_EXTRA_INDEX_URL=https://pypi.org/simple
ENV UV_CACHE_DIR=/workspace/.cache/uv
ENV npm_config_cache=/workspace/.cache/npm
ENV PIP_EXTRA_INDEX_URL=https://pypi.org/simple
ENV HOME=/workspace
ENV XDG_CACHE_HOME=/workspace/.cache
ENV PIP_CACHE_DIR=/workspace/.cache/pip
ENV PYTHONUSERBASE=/workspace/.local
ENV GOROOT=/usr/local/go
ENV GOPATH=/workspace/.go
ENV GOCACHE=/workspace/.cache/go-build
ENV PIP_BREAK_SYSTEM_PACKAGES=1
ENV PATH=/opt/programgym-venv/bin:/usr/local/go/bin:/workspace/.go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV PAGER=cat
ENV MANPAGER=cat
ENV LESS=-R
ENV TQDM_DISABLE=1
ENV VIRTUAL_ENV=/opt/programgym-venv
RUN apt-get update && apt-get install -y --no-install-recommends bash build-essential ca-certificates git make pkg-config python3 python3-pip curl wget xz-utils unzip zip bzip2 zstd patch file binutils python3-venv tar && rm -rf /var/lib/apt/lists/*
COPY programgym-go.tar.gz /tmp/programgym-go.tar.gz
RUN set -eux; rm -rf /usr/local/go; tar -C /usr/local -xzf /tmp/programgym-go.tar.gz; rm -f /tmp/programgym-go.tar.gz; if [ ! -x /usr/local/go/bin/go ]; then echo "official Go tarball did not create /usr/local/go/bin/go" >&2; exit 1; fi; /usr/local/go/bin/go version
RUN python3 -m venv /opt/programgym-venv && /opt/programgym-venv/bin/python -m pip install --no-cache-dir --only-binary=:all: pytest pytest-xdist coverage
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
# programgym-runtime-workspace-cleanup: v1
RUN ["bash","-lc","rm -f -- /workspace/download.sh /workspace/reference/build.sh && rm -rf -- /workspace/.programgym_build_env"]
# 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 set -eu; \
pip_break_system_packages=""; \
if python3 -m pip install --help | grep -q -- '--break-system-packages'; then \
pip_break_system_packages="--break-system-packages"; \
fi; \
python3 -m pip install ${pip_break_system_packages} \
--no-cache-dir --disable-pip-version-check --retries 10 --timeout 120 \
'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
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"]