Skip to content

only commit performance test if on main branch #83

only commit performance test if on main branch

only commit performance test if on main branch #83

Workflow file for this run

name: Docker Image CI
on:
push:
release:
types: [published]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract metadata
id: meta
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
else
TAG=${GITHUB_REF#refs/heads/}
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Build test Docker image
run: docker build --no-cache . --file Dockerfile --tag test-image
- name: Test container startup
run: |
docker run -d --name test-container -p 8080:8080 test-image
sleep 10
if docker ps | grep -q test-container; then
echo "Container is running successfully"
curl -sf http://localhost:8080/health || { echo "Health check failed"; docker logs test-container; exit 1; }
echo "Health check passed"
else
echo "Container failed to start"
docker logs test-container
exit 1
fi
docker stop test-container || true
docker rm test-container
- name: Build Docker image
run: docker build . --file Dockerfile --tag virtualflybrain/vfbquery:${{ steps.meta.outputs.tag }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push Docker image
run: docker push virtualflybrain/vfbquery:${{ steps.meta.outputs.tag }}