66 lines
2.6 KiB
YAML
66 lines
2.6 KiB
YAML
name: Build Provider Proxy Container
|
|
|
|
permissions: {}
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
DOCKERHUB_LIMITED_TOKEN:
|
|
required: true
|
|
|
|
jobs:
|
|
build-provider-proxy-container:
|
|
name: build-provider-proxy-container
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
if: github.repository == 'tensorzero/tensorzero'
|
|
permissions:
|
|
# Permission to checkout the repository
|
|
contents: read # Required for checkout or repository metadata reads.
|
|
# Permission to fetch GitHub OIDC token authentication
|
|
id-token: write # Required for OIDC-backed build or publish tooling.
|
|
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
|
with:
|
|
username: tensorzero
|
|
password: ${{ secrets.DOCKERHUB_LIMITED_TOKEN }}
|
|
|
|
# We allow the namespace builder setup to fail on Dependabot PRs and PRs from forks
|
|
# (where the oidc token is not available)
|
|
|
|
- name: Install Namespace CLI
|
|
uses: namespacelabs/nscloud-setup@f378676225212387f1283f4da878712af2c4cd60 # v0.0.11
|
|
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
|
|
|
|
- name: Configure Namespace-powered Buildx
|
|
uses: namespacelabs/nscloud-setup-buildx-action@91c2e6537780e3b092cb8476406be99a8f91bd5e # v0.0.20
|
|
with:
|
|
wait-for-builder: true
|
|
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
|
|
|
|
- name: Build and push `provider-proxy` container
|
|
run: |
|
|
docker buildx build --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 -f crates/provider-proxy/Dockerfile --target provider-proxy . -t tensorzero/provider-proxy:sha-$GITHUB_SHA --push
|
|
|
|
- name: Wait for image to be available on Docker Hub
|
|
run: |
|
|
IMAGE="tensorzero/provider-proxy:sha-$GITHUB_SHA"
|
|
echo "Waiting for ${IMAGE} to be available on Docker Hub..."
|
|
for i in $(seq 1 60); do
|
|
if docker manifest inspect "${IMAGE}" > /dev/null 2>&1; then
|
|
echo "Image ${IMAGE} is available on Docker Hub"
|
|
exit 0
|
|
fi
|
|
echo "Attempt ${i}/60: Image not yet available, waiting 5s..."
|
|
sleep 5
|
|
done
|
|
echo "Timed out waiting for ${IMAGE} to appear on Docker Hub"
|
|
exit 1
|