File size: 2,471 Bytes
dc71cad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM ubuntu:22.04

# ── System dependencies ────────────────────────────────────────────────────────
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    curl \
    wget \
    build-essential \
    libssl-dev \
    libffi-dev \
    python3.11 \
    python3.11-dev \
    python3.11-venv \
    python3-pip \
    && rm -rf /var/lib/apt/lists/*

# ── Make python3 point to python3.11 ─────────────────────────────────────────
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1

# ── Create non-root user (uid=1000) ──────────────────────────────────────────
RUN groupadd -g 1000 agent && useradd -u 1000 -g agent -m -s /bin/bash agent

# ── Upgrade pip and install test runner ──────────────────────────────────────
RUN python -m pip install --upgrade pip setuptools wheel && \
    pip install pytest pytest-xdist pytest-timeout

# ── Workspace setup ───────────────────────────────────────────────────────────
RUN mkdir -p /workspace && chown agent:agent /workspace

# ── Git configuration (needed for git apply) ──────────────────────────────────
RUN git config --global user.email "agent@code-agent" && \
    git config --global user.name "Code Agent" && \
    git config --global safe.directory '/workspace'

# ── Switch to non-root user ───────────────────────────────────────────────────
USER agent
WORKDIR /workspace

# ── Default command ───────────────────────────────────────────────────────────
# Actual command is injected by SandboxExecutor at runtime
CMD ["python", "-m", "pytest", "--help"]