Skip to content

Latest commit

 

History

History
 
 

docker

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Docker

To ensure reproducibility and sandboxed execution of SWE-agent actions across systems, we adopt practices established in prior work and use 🐋 Docker containers to carry out SWE-agent inference.

  • The swe.Dockerfile file is the customized image written for the environment of SWE-agent.
  • The ./setup.sh script automatically builds this image.
  • When run.py is invoked, containers are automatically created from the built image.
    • There is no need to manually build a container from the image.

Here, we explain what each line in swe.Dockerfile does:

  1. Base Image: Start from the latest version of the Ubuntu image.
FROM ubuntu:latest
  1. Build Argument: Define a build argument MINICONDA_URL that will be used to specify the Miniconda installer URL during the build process.
ARG MINICONDA_URL
  1. Install Third-Party Tools: Update the package lists for the Ubuntu package manager and install several essential development tools. Clean up after the installation.
RUN apt-get update && \
    apt-get install -y bash gcc git jq wget g   make && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*
  1. Initialize Git: Configure global Git settings with a user email and name.
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "sweagent"
  1. Environment Variables: Set the ROOT environment variable and customize the shell prompt.
ENV ROOT='/dev/'
RUN prompt() { echo " > "; };
ENV PS1="> "
  1. Create Assets for Inference: Create two files that are used to track metadata during an episode.
RUN touch /root/files_to_edit.txt
RUN touch /root/test.patch
  1. Enhance ls Command: Modify the .bashrc file to alias the ls command.
RUN echo "alias ls='ls -F'" >> /root/.bashrc
  1. Install Miniconda: Download and install Miniconda, then initialize conda with Bash support and add conda-forge to the channels list.
ENV PATH="/root/miniconda3/bin:${PATH}"
ARG PATH="/root/miniconda3/bin:${PATH}"
RUN wget ${MINICONDA_URL} -O miniconda.sh \
    && mkdir /root/.conda \
    && bash miniconda.sh -b \
    && rm -f miniconda.sh
RUN conda --version \
    && conda init bash \
    && conda config --append channels conda-forge
  1. Install Python Packages: Copy the requirements.txt file into the image and install the specified Python packages.
COPY docker/requirements.txt /root/requirements.txt
RUN pip install -r /root/requirements.txt
  1. Set Working Directory: Set the working directory to the root directory.
WORKDIR /
  1. Default Command: Set the default command to open a Bash shell when the container starts.
CMD ["/bin/bash"]