diff --git a/.github/workflows/ghcr-build.yml b/.github/workflows/ghcr-build.yml index 86687c514417..89c313cbec5c 100644 --- a/.github/workflows/ghcr-build.yml +++ b/.github/workflows/ghcr-build.yml @@ -78,12 +78,19 @@ jobs: export REPO_OWNER=${{ github.repository_owner }} REPO_OWNER=$(echo $REPO_OWNER | tr '[:upper:]' '[:lower:]') # Run the build script in the app image - docker run -e SANDBOX_USER_ID=0 -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/${REPO_OWNER}/openhands:$RELEVANT_SHA /bin/bash -c "mkdir -p containers/runtime; python3 openhands/runtime/utils/runtime_build.py --base_image ${{ env.BASE_IMAGE_FOR_HASH_EQUIVALENCE_TEST }} --build_folder containers/runtime --force_rebuild" 2>&1 | tee docker-outputs.txt + docker run -e SANDBOX_USER_ID=0 -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/${REPO_OWNER}/openhands:${{ env.RELEVANT_SHA }} /bin/bash -c "mkdir -p containers/runtime; python3 openhands/runtime/utils/runtime_build.py --base_image ${{ env.BASE_IMAGE_FOR_HASH_EQUIVALENCE_TEST }} --build_folder containers/runtime --force_rebuild" 2>&1 | tee docker-outputs.txt # Get the hash from the build script hash_from_app_image=$(cat docker-outputs.txt | grep "Hash for docker build directory" | awk -F "): " '{print $2}' | uniq | head -n1) echo "hash_from_app_image=$hash_from_app_image" >> $GITHUB_OUTPUT echo "Hash from app image: $hash_from_app_image" + # This test should move when we have a test suite for the app image + - name: Test docker in App Image + run: | + # Lowercase the repository owner + export REPO_OWNER=${{ github.repository_owner }} + REPO_OWNER=$(echo $REPO_OWNER | tr '[:upper:]' '[:lower:]') + docker run -e SANDBOX_USER_ID=0 -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/${REPO_OWNER}/openhands:${{ env.RELEVANT_SHA }} /bin/bash -c "docker run hello-world" # Builds the runtime Docker images ghcr_build_runtime: diff --git a/containers/app/Dockerfile b/containers/app/Dockerfile index 6df4fda5a3eb..ce2c0ba75c51 100644 --- a/containers/app/Dockerfile +++ b/containers/app/Dockerfile @@ -28,7 +28,7 @@ COPY ./pyproject.toml ./poetry.lock ./ RUN touch README.md RUN export POETRY_CACHE_DIR && poetry install --without evaluation,llama-index --no-root && rm -rf $POETRY_CACHE_DIR -FROM python:3.12.3-slim AS runtime +FROM python:3.12.3-slim AS openhands-app WORKDIR /app @@ -46,6 +46,14 @@ RUN mkdir -p $WORKSPACE_BASE RUN apt-get update -y \ && apt-get install -y curl ssh sudo +# Install Docker - https://docs.docker.com/engine/install/debian/ +RUN apt-get install ca-certificates curl \ + && curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc \ + && chmod a+r /etc/apt/keyrings/docker.asc \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && apt-get update \ + && apt install -y docker-ce + # Default is 1000, but OSX is often 501 RUN sed -i 's/^UID_MIN.*/UID_MIN 499/' /etc/login.defs # Default is 60000, but we've seen up to 200000