Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/hf_space_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build HF Space Docker Image

on:
push:
branches: [ main ]
paths:
- 'Dockerfile.hf-space'
- '.github/workflows/hf_space_docker.yml'
pull_request:
branches: [ main ]
paths:
- 'Dockerfile.hf-space'
- '.github/workflows/hf_space_docker.yml'
Comment on lines +5 to +13
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this action won't be triggered

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@Samoed Samoed Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this. This will be triggered only on changed in dockerfile for spaces, but I'm not sure if it will be enough to test then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to move these checks to leaderboard_docker.yml to test this more frequently and make sure that our leaderboard will work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, that's what the paths section of the workflow file shows. I'm not sure there's new info here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping these tests separate makes more sense.

workflow_dispatch:

jobs:
build-hf-space:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build HF Space Docker image
run: |
docker build -f Dockerfile.hf-space -t mteb-hf-space:test .
echo "✅ Docker image built successfully"

- name: Test Docker image
run: |
# Test that the image can be created and the container starts
docker run -d --name mteb-test -p 7860:7860 mteb-hf-space:test

# Give the container a moment to start
sleep 5

# Check if container is running
if docker ps | grep -q mteb-test; then
echo "✅ Container is running"
docker logs mteb-test
else
echo "❌ Container failed to start"
docker logs mteb-test
exit 1
fi

# Clean up
docker stop mteb-test
docker rm mteb-test

- name: Validate HF Space configuration
run: |
# Check that required environment variables and ports are set
docker run --rm mteb-hf-space:test sh -c '
if [ "$GRADIO_SERVER_NAME" = "0.0.0.0" ]; then
echo "✅ GRADIO_SERVER_NAME is correctly set"
else
echo "❌ GRADIO_SERVER_NAME is not set to 0.0.0.0"
exit 1
fi
'

# Check exposed port
EXPOSED_PORT=$(docker inspect mteb-hf-space:test --format='{{range $key, $value := .Config.ExposedPorts}}{{$key}}{{end}}' | grep -o '7860')
if [ "$EXPOSED_PORT" = "7860" ]; then
echo "✅ Port 7860 is exposed"
else
echo "❌ Port 7860 is not exposed"
exit 1
fi
6 changes: 6 additions & 0 deletions Dockerfile.hf-space
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/embeddings-benchmark/mteb/leaderboard:latest

ENV GRADIO_SERVER_NAME="0.0.0.0"
EXPOSE 7860

CMD ["make", "run-leaderboard"]