This repository was archived by the owner on Apr 21, 2026. It is now read-only.
Merge pull request #103 from paiindustries/fix/seo #78
Workflow file for this run
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: Wheels.dev | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| build-and-deploy-to-docker-swarm: | |
| runs-on: [self-hosted, Linux, pai] | |
| steps: | |
| - name: Checkout Repository | |
| id: Checkout-Repository | |
| uses: actions/checkout@v4 | |
| - name: Create Environment Files | |
| id: Create-Environment-Files | |
| run: | | |
| cp ./deploy/stage/.env ./ | |
| cp ./deploy/stage/server.json ./ | |
| cp ./deploy/stage/docker-compose.yml ./ | |
| cp ./deploy/stage/dockerfile ./ | |
| - name: Install Dependencies | |
| id: Install-Dependencies | |
| run: | | |
| box install | |
| - name: Login to Docker Registry | |
| run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login "${{ secrets.DOCKER_HUB_IP }}":"${{ secrets.DOCKER_HUB_PORT}}" -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin | |
| - name: Push Docker Image | |
| id: Push-Docker-Image | |
| run: | | |
| docker build -t ${{ secrets.DOCKER_HUB_IP }}:${{ secrets.DOCKER_HUB_PORT}}/wheels-dev-stage . | |
| docker push ${{ secrets.DOCKER_HUB_IP }}:${{ secrets.DOCKER_HUB_PORT}}/wheels-dev-stage | |
| - name: Run container and check health | |
| id: Run-Container-Health-Test | |
| run: | | |
| IMAGE=${{ secrets.DOCKER_HUB_IP }}:${{ secrets.DOCKER_HUB_PORT }}/wheels-dev-stage | |
| CONTAINER_NAME=wheels-dev-stage-test | |
| echo "Running test container from image: $IMAGE" | |
| docker run -d --name $CONTAINER_NAME $IMAGE | |
| echo "Waiting for container to become healthy..." | |
| TIMEOUT=60 | |
| INTERVAL=5 | |
| elapsed=0 | |
| while [ $elapsed -lt $TIMEOUT ]; do | |
| health=$(docker inspect -f '{{.State.Health.Status}}' $CONTAINER_NAME 2>/dev/null || echo "no-health") | |
| echo "Health status: $health" | |
| if [ "$health" = "healthy" ]; then | |
| echo "✅ Container is healthy." | |
| docker rm -f $CONTAINER_NAME | |
| exit 0 | |
| elif [ "$health" = "unhealthy" ]; then | |
| echo "❌ Container is unhealthy." | |
| docker logs $CONTAINER_NAME || true | |
| docker rm -f $CONTAINER_NAME || true | |
| exit 1 | |
| elif [ "$health" = "no-health" ]; then | |
| echo "❌ HEALTHCHECK not defined in image. Cannot proceed." | |
| docker rm -f $CONTAINER_NAME || true | |
| exit 1 | |
| fi | |
| sleep $INTERVAL | |
| elapsed=$((elapsed + INTERVAL)) | |
| done | |
| echo "❌ Container health status stuck at 'starting' for more than $TIMEOUT seconds." | |
| docker logs $CONTAINER_NAME || true | |
| docker rm -f $CONTAINER_NAME || true | |
| exit 1 | |
| - name: Deploy to Docker Swarm | |
| id: Deploy-to-Docker-Swarm | |
| run: | | |
| docker pull ${{ secrets.DOCKER_HUB_IP }}:${{ secrets.DOCKER_HUB_PORT}}/wheels-dev-stage | |
| docker stack deploy --with-registry-auth -c docker-compose.yml wheels-dev-stage |