Skip to content

Commit

Permalink
feat: add workflow to ghcr (All-Hands-AI#237)
Browse files Browse the repository at this point in the history
Co-authored-by: Xingyao Wang <xingyao6@illinois.edu>
  • Loading branch information
iFurySt and xingyaoww committed Mar 27, 2024
1 parent 9b51907 commit 8b9fc3d
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 8 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -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)
Empty file.
22 changes: 22 additions & 0 deletions agenthub/langchains_agent/Makefile
Original file line number Diff line number Diff line change
@@ -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 .
4 changes: 1 addition & 3 deletions evaluation/SWE-bench/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WORKDIR /home/swe-bench
# Setup Conda
ENV 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
Expand All @@ -35,5 +35,3 @@ RUN pip install datasets python-dotenv gitpython
RUN conda init bash

CMD ["/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.1
2 changes: 1 addition & 1 deletion evaluation/SWE-bench/scripts/run_docker_interactive.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

DOCKER_IMAGE=opendevin/eval-swe-bench:v0.1
DOCKER_IMAGE=ghcr.io/opendevin/eval-swe-bench:v0.1
WORK_DIR=`pwd`

docker run \
Expand Down
3 changes: 0 additions & 3 deletions opendevin/sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.1
22 changes: 22 additions & 0 deletions opendevin/sandbox/Makefile
Original file line number Diff line number Diff line change
@@ -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 .
2 changes: 1 addition & 1 deletion opendevin/sandbox/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
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"
Expand Down

0 comments on commit 8b9fc3d

Please sign in to comment.