π OpenHands: AI-Driven Development
feat: add workflow to ghcr (#237)
iFurySt8b9fc3df289a
diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.ymlnew file mode 100644index 0000000000..77743a2e02--- /dev/null+++ b/.github/workflows/ghcr.yml@@ -0,0 +1,45 @@+name: Build and publish multi-arch container images++on:+ push:+ branches: [ main ]+ workflow_dispatch:+ inputs:+ reason:+ description: 'Why manual trigger?'+ required: false+ default: ''++jobs:+ ghcr_build_and_push:+ runs-on: ubuntu-latest+ if: github.event_name == 'push'++ steps:+ - name: checkout+ uses: actions/checkout@v4++ - name: Set up QEMU+ uses: docker/setup-qemu-action@v3++ - name: Set up Docker Buildx+ id: buildx+ uses: docker/setup-buildx-action@v3++ - name: Log-in to ghcr.io+ run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin++ - name: Build and push multi-arch container images+ run: |+ # set env for fork repo+ DOCKER_BUILD_ORG=$(echo "${{ github.repository }}" | tr '[A-Z]' '[a-z]' | cut -d '/' -f 1)+ # Find directories containing Dockerfile but not containing .dockerfileignore+ while IFS= read -r dockerfile_dir; do+ # Check if .dockerfileignore exists in the directory+ if [ ! -f "$dockerfile_dir/.dockerfileignore" ]; then+ # Change directory and execute 'make all'+ pushd "$dockerfile_dir" > /dev/null+ make all DOCKER_BUILD_ORG=$DOCKER_BUILD_ORG+ popd > /dev/null+ fi+ done < <(find . -type f -name Dockerfile -exec dirname {} \; | sort -u)diff --git a/agenthub/langchains_agent/.dockerfileignore b/agenthub/langchains_agent/.dockerfileignorenew file mode 100644index 0000000000..e69de29bb2diff --git a/agenthub/langchains_agent/Makefile b/agenthub/langchains_agent/Makefilenew file mode 100644index 0000000000..f40f11824d--- /dev/null+++ b/agenthub/langchains_agent/Makefile@@ -0,0 +1,22 @@+DOCKER_BUILD_REGISTRY=ghcr.io+DOCKER_BUILD_ORG=opendevin+DOCKER_BUILD_REPO=eval-swe-bench+DOCKER_BUILD_TAG=v0.1+FULL_IMAGE=$(DOCKER_BUILD_REGISTRY)/$(DOCKER_BUILD_ORG)/$(DOCKER_BUILD_REPO):$(DOCKER_BUILD_TAG)+LATEST_FULL_IMAGE=$(DOCKER_BUILD_REGISTRY)/$(DOCKER_BUILD_ORG)/$(DOCKER_BUILD_REPO):latest++# normally, for local build testing or development. use cross platform build for sharing images to others.+build:+ docker build -f Dockerfile -t ${FULL_IMAGE} -t ${LATEST_FULL_IMAGE} .++push:+ docker push ${FULL_IMAGE} ${LATEST_FULL_IMAGE}++test:+ docker buildx build --platform linux/amd64 \+ -t ${FULL_IMAGE} -t ${LATEST_FULL_IMAGE} --load -f Dockerfile .++# cross platform build, you may need to manually stop the buildx(buildkit) container+all:+ docker buildx build --platform linux/amd64,linux/arm64 \+ -t ${FULL_IMAGE} -t ${LATEST_FULL_IMAGE} --push -f Dockerfile .\ No newline at end of filediff --git a/evaluation/SWE-bench/Dockerfile b/evaluation/SWE-bench/Dockerfileindex aabcee88fc..32d0d02f50 100644--- a/evaluation/SWE-bench/Dockerfile+++ b/evaluation/SWE-bench/Dockerfile@@ -19,7 +19,7 @@ WORKDIR /home/swe-bench# Setup CondaENV PATH="/home/swe-bench/miniconda3/bin:${PATH}"ARG PATH="/home/swe-bench/miniconda3/bin:${PATH}"-RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh \+RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-`uname -m`.sh -O miniconda.sh \&& mkdir ~/.conda \&& bash miniconda.sh -b \&& rm -f miniconda.sh@@ -35,5 +35,3 @@ RUN pip install datasets python-dotenv gitpythonRUN conda init bashCMD ["/bin/bash"]-# docker build -t opendevin/eval-swe-bench:v0.1 -f evaluation/swe-bench/Dockerfile evaluation/swe-bench/-# docker push opendevin/eval-swe-bench:v0.1diff --git a/evaluation/SWE-bench/scripts/run_docker_interactive.sh b/evaluation/SWE-bench/scripts/run_docker_interactive.shindex 4407884e45..1c8475b2af 100755--- a/evaluation/SWE-bench/scripts/run_docker_interactive.sh+++ b/evaluation/SWE-bench/scripts/run_docker_interactive.sh@@ -1,6 +1,6 @@#!/bin/bash-DOCKER_IMAGE=opendevin/eval-swe-bench:v0.1+DOCKER_IMAGE=ghcr.io/opendevin/eval-swe-bench:v0.1WORK_DIR=`pwd`docker run \diff --git a/opendevin/sandbox/Dockerfile b/opendevin/sandbox/Dockerfileindex d855985a60..6b4a8924cb 100644--- a/opendevin/sandbox/Dockerfile+++ b/opendevin/sandbox/Dockerfile@@ -15,6 +15,3 @@ RUN apt-get update && apt-get install -y \python3-dev \build-essential \&& rm -rf /var/lib/apt/lists/*--# docker build -f opendevin/sandbox/Dockerfile -t opendevin/sandbox:v0.1 .-# docker push opendevin/sandbox:v0.1diff --git a/opendevin/sandbox/Makefile b/opendevin/sandbox/Makefilenew file mode 100644index 0000000000..9d82aed0a9--- /dev/null+++ b/opendevin/sandbox/Makefile@@ -0,0 +1,22 @@+DOCKER_BUILD_REGISTRY=ghcr.io+DOCKER_BUILD_ORG=opendevin+DOCKER_BUILD_REPO=sandbox+DOCKER_BUILD_TAG=v0.1+FULL_IMAGE=$(DOCKER_BUILD_REGISTRY)/$(DOCKER_BUILD_ORG)/$(DOCKER_BUILD_REPO):$(DOCKER_BUILD_TAG)+LATEST_FULL_IMAGE=$(DOCKER_BUILD_REGISTRY)/$(DOCKER_BUILD_ORG)/$(DOCKER_BUILD_REPO):latest++# normally, for local build testing or development. use cross platform build for sharing images to others.+build:+ docker build -f Dockerfile -t ${FULL_IMAGE} -t ${LATEST_FULL_IMAGE} .++push:+ docker push ${FULL_IMAGE} ${LATEST_FULL_IMAGE}++test:+ docker buildx build --platform linux/amd64 \+ -t ${FULL_IMAGE} -t ${LATEST_FULL_IMAGE} --load -f Dockerfile .++# cross platform build, you may need to manually stop the buildx(buildkit) container+all:+ docker buildx build --platform linux/amd64,linux/arm64 \+ -t ${FULL_IMAGE} -t ${LATEST_FULL_IMAGE} --push -f Dockerfile .diff --git a/opendevin/sandbox/sandbox.py b/opendevin/sandbox/sandbox.pyindex 04162242e1..bec2a75584 100644--- a/opendevin/sandbox/sandbox.py+++ b/opendevin/sandbox/sandbox.py@@ -14,7 +14,7 @@ OutputType = namedtuple("OutputType", ["content"])DIRECTORY_REWRITE = os.getenv("DIRECTORY_REWRITE", "") # helpful for docker-in-docker scenarios-CONTAINER_IMAGE = os.getenv("SANDBOX_CONTAINER_IMAGE", "opendevin/sandbox:v0.1")+CONTAINER_IMAGE = os.getenv("SANDBOX_CONTAINER_IMAGE", "ghcr.io/opendevin/sandbox:v0.1")# FIXME: On some containers, the devin user doesn't have enough permission, e.g. to install packages# How do we make this more flexible?RUN_AS_DEVIN = os.getenv("RUN_AS_DEVIN", "true").lower() != "false"