forked from All-Hands-AI/OpenHands
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add workflow to ghcr (All-Hands-AI#237)
Co-authored-by: Xingyao Wang <xingyao6@illinois.edu>
- Loading branch information
Showing
8 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters