FROM ubuntu:24.04 ENV DEBIAN_FRONTEND=noninteractive \ UV_LINK_MODE=copy \ UV_CACHE_DIR=/opt/uv-cache \ UV_PYTHON_INSTALL_DIR=/usr/local/share/uv/python \ UV_PYTHON_BIN_DIR=/usr/local/bin \ RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ COREPACK_HOME=/opt/corepack \ PATH=/usr/local/go/bin:/usr/local/cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin RUN apt-get update && apt-get install -y --no-install-recommends \ bash build-essential ca-certificates curl git jq passwd pkg-config procps unzip xz-utils \ && rm -rf /var/lib/apt/lists/* ENV PLAYWRIGHT_BROWSERS_PATH=/opt/playwright RUN mkdir -p "$PLAYWRIGHT_BROWSERS_PATH" && chmod 755 "$PLAYWRIGHT_BROWSERS_PATH" \ && arch="$(dpkg --print-architecture)" && case "$arch" in arm64) node_arch=arm64 ;; amd64) node_arch=x64 ;; *) exit 1 ;; esac \ && curl -fsSL "https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-${node_arch}.tar.xz" | tar -C /usr/local --strip-components=1 -xJ \ && mkdir -p /opt/corepack && chmod 755 /opt/corepack \ && corepack enable RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | env RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo sh -s -- -y --no-modify-path --profile minimal --default-toolchain 1.90.0 RUN useradd --create-home --shell /bin/bash agent COPY repo.tar.gz /tmp/repo.tar.gz RUN mkdir -p /app && tar -xzf /tmp/repo.tar.gz -C /app && rm /tmp/repo.tar.gz \ && git -C /app init -q \ && git -C /app config user.email selfbench@local \ && git -C /app config user.name selfbench \ && git -C /app add -A \ && git -C /app commit -qm base RUN mkdir -p /opt/uv-cache && chmod 777 /opt/uv-cache \ && cd '/app/.' \ && bash -lc 'corepack enable && corepack prepare pnpm@10.33.0 --activate && pnpm install --frozen-lockfile && pnpm swc-build-native && pnpm build' \ && chmod -R a+rwX /opt/uv-cache RUN git -C /app reset --hard -q HEAD \ && git -C /app clean -fdq \ && mkdir -p /opt/selfbench \ && cp -a /app/.git /opt/selfbench/base.git \ && chown -R agent:agent /app /home/agent /opt/uv-cache \ && chown -R root:root /opt/selfbench \ && chmod 700 /opt/selfbench \ && mkdir -p /home/agent/.cache/uv \ && chown -R agent:agent /home/agent/.cache ENV UV_CACHE_DIR=/home/agent/.cache/uv \ UV_NO_BUILD_ISOLATION=1 USER agent WORKDIR /app