Spaces:
Paused
Paused
| name: Docker Container Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get short commit hash | |
| id: vars | |
| run: echo "tag=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Build the Docker image | |
| run: docker build . --tag ask-pesu-db | |
| - name: Run container | |
| run: | | |
| docker run --name ask-pesu-db -d -p 7860:7860 \ | |
| -e reddit_client_id="${{ secrets.REDDIT_CLIENT_ID }}" \ | |
| -e reddit_lient_secret="${{ secrets.REDDIT_CLIENT_SECRET }}" \ | |
| -e qdrant_url="${{ secrets.QDRANT_URL }}" \ | |
| -e qdrant_api_key="${{ secrets.QDRANT_API_KEY }}" \ | |
| ask-pesu-db | |
| - name: Wait for the container to be ready | |
| run: | | |
| for i in {1..60}; do | |
| if curl --silent http://localhost:7860/health > /dev/null; then | |
| echo "✅ Service is up!" | |
| exit 0 | |
| fi | |
| echo "⏳ Waiting for service..." | |
| sleep 15 | |
| done | |
| echo "❌ Service did not start in time." | |
| exit 1 | |
| - name: Stop container | |
| run: docker stop ask-pesu-db | |
| - name: Remove container | |
| run: docker rm ask-pesu-db | |