File size: 5,761 Bytes
af2930e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# pgym/base:v6 — toolchain base shared by every ProgramLab task image.
#
# Layers 1-19 reproduce the base of the official ProgramBench task_cleanroom_v6
# images (recovered from `docker history` of a genuine upstream image), so a
# submission that compiles upstream compiles here. The final layer is the only
# ProgramLab delta: pip packages our test blobs import that upstream does not ship.
#
#   docker build -t pgym/base:v6 -f docker/base.v6.Dockerfile docker/

FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive
ARG APT_SNAPSHOT=20260601T000000Z

RUN sed -i \
        -e "s|http://archive.ubuntu.com/ubuntu/|https://snapshot.ubuntu.com/ubuntu/${APT_SNAPSHOT}/|g" \
        -e "s|http://security.ubuntu.com/ubuntu/|https://snapshot.ubuntu.com/ubuntu/${APT_SNAPSHOT}/|g" \
        /etc/apt/sources.list \
    && echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99snapshot \
    && apt-get -o Acquire::https::Verify-Peer=false update \
    && apt-get -o Acquire::https::Verify-Peer=false install -y --no-install-recommends ca-certificates

RUN apt-get update \
    && apt-get install -y \
    curl wget git build-essential jq locales cmake sudo \
    && rm -rf /var/lib/apt/lists/*

ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain 1.92.0 \
    && chmod -R a+rwX /usr/local/rustup /usr/local/cargo

RUN set -eux; \
    arch="$(dpkg --print-architecture)"; \
    case "$arch" in \
        'amd64') url='https://dl.google.com/go/go1.21.0.linux-amd64.tar.gz' ;; \
        'arm64') url='https://dl.google.com/go/go1.21.0.linux-arm64.tar.gz' ;; \
        *) echo >&2 "error: unsupported architecture '$arch'"; exit 1 ;; \
    esac; \
    wget -O go.tgz "$url" --progress=dot:giga; \
    tar -C /usr/local -xzf go.tgz; \
    rm go.tgz

ENV PATH=/usr/local/go/bin:/usr/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

RUN go version

RUN apt-get update && apt-get install -y python3 python3-pip tmux && rm -rf /var/lib/apt/lists/*

RUN pip3 install --no-cache-dir \
    exceptiongroup==1.3.1 execnet==2.1.2 iniconfig==2.3.0 libtmux==0.58.0 \
    packaging==26.2 pluggy==1.6.0 pygments==2.20.0 pytest==9.0.3 \
    pytest-dependency==0.6.1 pytest-xdist==3.8.0 setuptools==82.0.1 \
    tomli==2.4.1 typing-extensions==4.15.0

RUN apt-get update && apt-get install -y --no-install-recommends \
    pkg-config \
    libncurses-dev \
    libtinfo-dev \
    zlib1g-dev \
    libssl-dev \
    libpcre2-dev \
    liblzma-dev \
    libreadline-dev \
    libsqlite3-dev \
    libcurl4-openssl-dev \
    libgit2-dev \
    libfmt-dev \
    libonig-dev \
    && rm -rf /var/lib/apt/lists/*

RUN cargo init /tmp/_rust_cache && cd /tmp/_rust_cache \
    && cargo add \
        clap@=4.6.1 serde@=1.0.228 serde_json@=1.0.150 regex@=1.12.4 \
        anyhow@=1.0.102 tempfile@=3.27.0 log@=0.4.32 thiserror@=1.0.69 \
        rayon@=1.12.0 tokio@=1.52.3 chrono@=0.4.45 rand@=0.8.6 \
        itertools@=0.13.0 toml@=1.1.2 walkdir@=2.5.0 crossterm@=0.29.0 \
        lazy_static@=1.5.0 assert_cmd@=2.2.2 clap_complete@=4.6.5 \
        unicode-width@=0.2.2 ignore@=0.4.26 pretty_assertions@=1.4.1 \
        url@=2.5.8 indexmap@=2.14.0 libc@=0.2.186 once_cell@=1.21.4 \
        dirs@=6.0.0 criterion@=0.8.2 clap_mangen@=0.3.0 env_logger@=0.11.10 \
        predicates@=3.1.4 ratatui@=0.30.1 flate2@=1.1.9 serde_yaml@=0.9.34 \
        memchr@=2.8.1 bstr@=1.12.1 glob@=0.3.3 crossbeam-channel@=0.5.15 \
        base64@=0.22.1 git2@=0.21.0 colored@=3.1.1 \
    && cargo fetch \
    && rm -rf /tmp/_rust_cache \
    && chmod -R a+rwX /usr/local/cargo

ENV GOMODCACHE=/usr/local/go/mod-cache

RUN export GOTOOLCHAIN=go1.25.11 \
    && mkdir -p $GOMODCACHE /tmp/_go_cache && cd /tmp/_go_cache \
    && go mod init cache-seed \
    && go get \
        github.com/stretchr/testify@v1.11.1 \
        github.com/mattn/go-isatty@v0.0.22 \
        golang.org/x/sys@v0.46.0 \
        golang.org/x/term@v0.44.0 \
        gopkg.in/yaml.v3@v3.0.1 \
        github.com/spf13/cobra@v1.10.2 \
        github.com/mattn/go-runewidth@v0.0.24 \
        golang.org/x/tools@v0.45.0 \
        golang.org/x/mod@v0.37.0 \
        github.com/BurntSushi/toml@v1.6.0 \
        github.com/fatih/color@v1.19.0 \
        github.com/gdamore/tcell/v2@v2.13.10 \
        golang.org/x/sync@v0.21.0 \
        golang.org/x/text@v0.38.0 \
        golang.org/x/crypto@v0.53.0 \
        golang.org/x/net@v0.56.0 \
        github.com/google/go-cmp@v0.7.0 \
        github.com/sirupsen/logrus@v1.9.4 \
        github.com/google/uuid@v1.6.0 \
        github.com/spf13/pflag@v1.0.10 \
        github.com/spf13/afero@v1.15.0 \
    && rm -rf /tmp/_go_cache \
    && chmod -R a+rwX $GOMODCACHE

RUN git config --global user.email "johnby@meta.com"
RUN git config --global user.name "RevEng Bot"
RUN chmod 755 /root
RUN useradd -m -s /bin/bash agent \
    && echo 'agent ALL=(root) NOPASSWD: /usr/bin/apt-get, /usr/bin/apt, /usr/bin/dpkg, /usr/bin/pip3, /usr/bin/pip, /usr/local/go/bin/go, /usr/local/cargo/bin/cargo, /usr/bin/npm, /usr/bin/npx, /sbin/ldconfig' \
        >> /etc/sudoers.d/agent-packages
RUN git config --global --add safe.directory /workspace

# ProgramLab delta: imported by our generated test blobs, absent upstream.
RUN pip3 install --no-cache-dir \
    pexpect==4.9.0 ptyprocess==0.7.0 PyYAML==6.0.3 pypdf==6.16.0 \
    pyte==0.8.2 sh==2.4.0 pytest-timeout==2.4.0 \
    grpcio==1.83.0 grpcio-tools==1.83.0 protobuf==7.35.1

# Upstream chowns /workspace during task injection; COPY --chown leaves the dir itself alone.
RUN mkdir /workspace && chown agent:agent /workspace
WORKDIR /workspace