mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* try to fix pip unavailable * update test case for pip * force rebuild in CI * remove extra symlink * fix newline * added semi-colon to line 31 * Dockerfile.j2: activate env at the end * Revert "Dockerfile.j2: activate env at the end" This reverts commit cf2f5651021fe80d4ab69a35a85f0a35b29dc3d7. * cleanup Dockerfile * switch default python image * remove image agnostic (no longer used) * fix tests * simplify integration tests default image * add nodejs specific runtime tests * update tests and workflows * switch to nikolaik/python-nodejs:python3.11-nodejs22 * update build sh to output image name correctly * increase custom images to test * fix test * fix test * fix double quote * try fixing ci * update ghcr workflow * fix artifact name * try to fix ghcr again * fix workflow * save built image to correct dir * remove extra -docker-image * make last tag to be human readable image tag * fix hyphen to underscore * run test runtime on all tags * revert app build * separate ghcr workflow * update dockerfile for eval * fix tag for test run * try fix tag * try fix tag via matrix output * try workflow again * update comments * try fixing test matrix * fix artifact name * try fix tag again * Revert "try fix tag again" This reverts commit b369badd8cccf4a526e36d27eafb77ea2d32f6be. * tweak filename * try different path * fix filepath * try fix tag artifact path again * save json instead of line * update matrix * print all tags in workflow * fix DOCKER_IMAGE to avoid ghcr.io/opendevin/ghcr.io/opendevin/od_runtime * fix test matrix to only load unique test image tags * try fix matrix again!!!!! * add all runtime tests passed --------- Co-authored-by: tobitege <tobitege@gmx.de> Co-authored-by: Graham Neubig <neubig@gmail.com> Co-authored-by: tobitege <10787084+tobitege@users.noreply.github.com>
84 lines
2.1 KiB
Bash
Executable File
84 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
image_name=$1
|
|
org_name=$2
|
|
platform=$3
|
|
|
|
echo "Building: $image_name for platform: $platform"
|
|
tags=()
|
|
|
|
OPEN_DEVIN_BUILD_VERSION="dev"
|
|
|
|
if [[ -n $GITHUB_REF_NAME ]]; then
|
|
# check if ref name is a version number
|
|
if [[ $GITHUB_REF_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
major_version=$(echo "$GITHUB_REF_NAME" | cut -d. -f1)
|
|
minor_version=$(echo "$GITHUB_REF_NAME" | cut -d. -f1,2)
|
|
tags+=("$major_version" "$minor_version")
|
|
tags+=("latest")
|
|
fi
|
|
sanitized=$(echo "$GITHUB_REF_NAME" | sed 's/[^a-zA-Z0-9.-]\+/-/g')
|
|
OPEN_DEVIN_BUILD_VERSION=$sanitized
|
|
tag=$(echo "$sanitized" | tr '[:upper:]' '[:lower:]') # lower case is required in tagging
|
|
tags+=("$tag")
|
|
fi
|
|
echo "Tags: ${tags[@]}"
|
|
|
|
if [[ "$image_name" == "opendevin" ]]; then
|
|
dir="./containers/app"
|
|
elif [[ "$image_name" == "od_runtime" ]]; then
|
|
dir="./containers/runtime"
|
|
else
|
|
dir="./containers/$image_name"
|
|
fi
|
|
|
|
if [[ (! -f "$dir/Dockerfile") && "$image_name" != "od_runtime" ]]; then
|
|
# Allow runtime to be built without a Dockerfile
|
|
echo "No Dockerfile found"
|
|
exit 1
|
|
fi
|
|
if [[ ! -f "$dir/config.sh" ]]; then
|
|
echo "No config.sh found for Dockerfile"
|
|
exit 1
|
|
fi
|
|
|
|
source "$dir/config.sh"
|
|
|
|
if [[ -n "$org_name" ]]; then
|
|
DOCKER_ORG="$org_name"
|
|
fi
|
|
|
|
# If $DOCKER_IMAGE_HASH_TAG is set, add it to the tags
|
|
if [[ -n "$DOCKER_IMAGE_HASH_TAG" ]]; then
|
|
tags+=("$DOCKER_IMAGE_HASH_TAG")
|
|
fi
|
|
# If $DOCKER_IMAGE_TAG is set, add it to the tags
|
|
if [[ -n "$DOCKER_IMAGE_TAG" ]]; then
|
|
tags+=("$DOCKER_IMAGE_TAG")
|
|
fi
|
|
|
|
DOCKER_REPOSITORY="$DOCKER_REGISTRY/$DOCKER_ORG/$DOCKER_IMAGE"
|
|
DOCKER_REPOSITORY=${DOCKER_REPOSITORY,,} # lowercase
|
|
echo "Repo: $DOCKER_REPOSITORY"
|
|
echo "Base dir: $DOCKER_BASE_DIR"
|
|
|
|
args=""
|
|
for tag in "${tags[@]}"; do
|
|
args+=" -t $DOCKER_REPOSITORY:$tag"
|
|
done
|
|
|
|
output_image="/tmp/${image_name}_${tags[-1]}_${platform}.tar"
|
|
echo "Output image will be saved to: $output_image"
|
|
|
|
docker buildx build \
|
|
$args \
|
|
--build-arg OPEN_DEVIN_BUILD_VERSION="$OPEN_DEVIN_BUILD_VERSION" \
|
|
--platform linux/$platform \
|
|
--provenance=false \
|
|
-f "$dir/Dockerfile" \
|
|
--output type=docker,dest="$output_image" \
|
|
"$DOCKER_BASE_DIR"
|
|
|
|
echo "${tags[*]}" > tags.txt
|