build(docker): switch to chainguard wolfi-base, upgrade deps to 0.0.9… #434
This file contains hidden or 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
| name: Build And Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| DOCKER_REPOSITORY: quay.io/unstructured-io/unstructured-api | |
| DOCKER_BUILD_REPOSITORY: quay.io/unstructured-io/build-unstructured-api | |
| PACKAGE: "unstructured-api" | |
| PIPELINE_FAMILY: "general" | |
| PIP_VERSION: "25.1.1" | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/cache@v5 | |
| id: virtualenv-cache | |
| with: | |
| path: | | |
| .venv | |
| key: ci-venv-${{ env.PIPELINE_FAMILY }}-${{ hashFiles('requirements/test.txt') }} | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Setup virtual environment (no cache hit) | |
| if: steps.virtualenv-cache.outputs.cache-hit != 'true' | |
| run: | | |
| python${{ env.PYTHON_VERSION }} -m venv .venv | |
| source .venv/bin/activate | |
| make install-ci | |
| set-short-sha: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| short_sha: ${{ steps.set_short_sha.outputs.short_sha }} | |
| steps: | |
| - name: Set Short SHA | |
| id: set_short_sha | |
| run: echo "short_sha=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT | |
| build-images: | |
| strategy: | |
| matrix: | |
| #arch: ["arm64", "amd64"] | |
| # NOTE(luke): temporary disable arm64 since its failing the smoke test | |
| arch: ["amd64"] | |
| runs-on: ubuntu-latest | |
| needs: [setup, set-short-sha] | |
| env: | |
| SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} | |
| DOCKER_PLATFORM: linux/${{ matrix.arch }} | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: ${{ matrix.arch == 'amd64' && 'docker' || 'docker-container' }} | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Login to Quay.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} | |
| password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} | |
| - name: Free up disk space | |
| run: | | |
| # Clear some space (https://github.com/actions/runner-images/issues/2840) | |
| echo "Disk usage before cleanup:" | |
| df -h | |
| # Remove unnecessary pre-installed software | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /usr/local/share/boost | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo rm -rf /usr/local/.ghcup | |
| sudo rm -rf /usr/share/swift | |
| # Clean up docker to ensure we start fresh | |
| docker system prune -af --volumes | |
| echo "Disk usage after cleanup:" | |
| df -h | |
| - name: Build image | |
| run: | | |
| DOCKER_BUILDKIT=1 docker buildx build --load -f Dockerfile \ | |
| --platform=$DOCKER_PLATFORM \ | |
| --build-arg PIP_VERSION=$PIP_VERSION \ | |
| --build-arg BUILDKIT_INLINE_CACHE=1 \ | |
| --build-arg PIPELINE_PACKAGE=${{ env.PIPELINE_FAMILY }} \ | |
| --provenance=false \ | |
| --progress plain \ | |
| --cache-from $DOCKER_BUILD_REPOSITORY:${{ matrix.arch }} \ | |
| -t $DOCKER_BUILD_REPOSITORY:${{ matrix.arch }}-$SHORT_SHA . | |
| - name: Set virtualenv cache | |
| uses: actions/cache@v5 | |
| id: virtualenv-cache | |
| with: | |
| path: | | |
| .venv | |
| key: ci-venv-${{ env.PIPELINE_FAMILY }}-${{ hashFiles('requirements/test.txt') }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Test image | |
| run: | | |
| source .venv/bin/activate | |
| export DOCKER_IMAGE="$DOCKER_BUILD_REPOSITORY:${{ matrix.arch }}-$SHORT_SHA" | |
| if [ "$DOCKER_PLATFORM" == "linux/arm64" ]; then | |
| SKIP_INFERENCE_TESTS=true make docker-test | |
| else | |
| make docker-test | |
| fi | |
| - name: Push image | |
| run: | | |
| # write to the build repository to cache for the publish-images job | |
| docker push $DOCKER_BUILD_REPOSITORY:${{ matrix.arch }}-$SHORT_SHA | |
| publish-images: | |
| runs-on: ubuntu-latest | |
| needs: [setup, set-short-sha, build-images] | |
| env: | |
| SHORT_SHA: ${{ needs.set-short-sha.outputs.short_sha }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set SHORT_SHA | |
| run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
| - name: Login to Quay.io | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: quay.io | |
| username: ${{ secrets.QUAY_IO_ROBOT_USERNAME }} | |
| password: ${{ secrets.QUAY_IO_ROBOT_TOKEN }} | |
| - name: Pull AMD image | |
| run: | | |
| docker pull $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA | |
| # - name: Pull ARM image | |
| # run: | | |
| # docker pull $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA | |
| - name: Push AMD and ARM tags | |
| run: | | |
| # these are used to construct the final manifest but also cache-from in subsequent runs | |
| docker tag $DOCKER_BUILD_REPOSITORY:amd64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 | |
| docker push $DOCKER_BUILD_REPOSITORY:amd64 | |
| #docker tag $DOCKER_BUILD_REPOSITORY:arm64-$SHORT_SHA $DOCKER_BUILD_REPOSITORY:arm64 | |
| #docker push $DOCKER_BUILD_REPOSITORY:arm64 | |
| - name: Push multiarch manifest | |
| run: | | |
| #docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 | |
| docker manifest create ${DOCKER_REPOSITORY}:latest $DOCKER_BUILD_REPOSITORY:amd64 | |
| docker manifest push $DOCKER_REPOSITORY:latest | |
| #docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 | |
| docker manifest create ${DOCKER_REPOSITORY}:$SHORT_SHA $DOCKER_BUILD_REPOSITORY:amd64 | |
| docker manifest push $DOCKER_REPOSITORY:$SHORT_SHA | |
| VERSION=$(grep -m1 version preprocessing-pipeline-family.yaml | cut -d ' ' -f2) | |
| #docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 $DOCKER_BUILD_REPOSITORY:arm64 | |
| docker manifest create ${DOCKER_REPOSITORY}:$VERSION $DOCKER_BUILD_REPOSITORY:amd64 | |
| docker manifest push ${DOCKER_REPOSITORY}:$VERSION |