update
All checks were successful
Backend EC - Modal Deployment / build-and-push (push) Successful in 8m4s
Backend EC - Modal Deployment / notify-deploy (push) Successful in 3s

This commit is contained in:
DatTT127
2026-07-20 00:26:16 +07:00
parent d3d91998ab
commit 64284a229f
3 changed files with 78 additions and 6 deletions

View File

@@ -105,11 +105,8 @@ jobs:
DEPLOY_WEBHOOK_URL: ${{ secrets.DEPLOY_WEBHOOK_URL }}
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
run: |
echo "check the webhook URL ${{ secrets.DEPLOY_WEBHOOK_URL }}" | base64
cat <<EOF | curl -X POST "${DEPLOY_WEBHOOK_URL}" \
-H "Content-Type: application/json" \
-H "X-Gitea-Signature: sha256=$(echo -n '@-' | openssl dgst -sha256 -hmac "${WEBHOOK_SECRET}" | cut -d' ' -f2)" \
-d @-
PAYLOAD=$(mktemp)
cat > "$PAYLOAD" <<EOF
{
"service": "cv-inference-server",
"image": "${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ steps.tag.outputs.tag }}",
@@ -122,4 +119,11 @@ jobs:
"ECR_PUBLIC_REGISTRY_ALIAS": "${{ vars.ECR_PUBLIC_REGISTRY_ALIAS }}"
}
}
EOF
EOF
SIG="sha256=$(openssl dgst -sha256 -hmac "${WEBHOOK_SECRET}" "$PAYLOAD" | cut -d' ' -f2)"
echo "check the webhook URL ${DEPLOY_WEBHOOK_URL}" | base64
curl -X POST "${DEPLOY_WEBHOOK_URL}" \
-H "Content-Type: application/json" \
-H "X-Gitea-Signature: ${SIG}" \
--data-binary "@${PAYLOAD}"
rm -f "$PAYLOAD"

View File

@@ -66,6 +66,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
libglib2.0-0 \
zlib1g \
&& rm -rf /var/lib/apt/lists/*
# Create virtual environment so we can copy a single tree to runtime
@@ -135,6 +136,7 @@ COPY --from=builder /usr/local/lib/ /usr/local/lib/
# Drop our extracted dynamic system C-libraries into the system runtime path
COPY --from=builder /opt/venv/libglib-2.0.so.0 /lib/x86_64-linux-gnu/libglib-2.0.so.0
COPY --from=builder /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1
# Step 3: Use the exact matching numeric IDs for --chown
# COPY --from=builder --chown=999:999 /opt/venv /opt/venv

View File

@@ -0,0 +1,66 @@
#!/usr/bin/env bash
# Smoke test for published ECR image:
# public.ecr.aws/i9a4e3f6/msk-cv-inference-server:latest
#
# Validates:
# 1. Image pulls successfully
# 2. Container starts
# 3. /health responds 200
# 4. /docs or /openapi.json is reachable
#
# Usage:
# bash scripts/smoke_test_backend_image.sh
set -euo pipefail
IMAGE="public.ecr.aws/i9a4e3f6/msk-cv-inference-server:latest"
CONTAINER_NAME="cv-inference-server-smoke"
PORT=8001
HEALTH_URL="http://127.0.0.1:${PORT}/health"
echo "==> Pulling image: ${IMAGE}"
docker pull "${IMAGE}"
echo "==> Removing old container if exists"
docker rm -f "${CONTAINER_NAME}" 2>/dev/null || true
echo "==> Starting container"
docker run -d \
--name "${CONTAINER_NAME}" \
-p "${PORT}:${PORT}" \
-e TRITON_ENDPOINT="http://dummy-triton:8000" \
-e CV_INFERENCE_HOST="0.0.0.0" \
-e CV_INFERENCE_PORT="${PORT}" \
"${IMAGE}"
cleanup() {
echo "==> Cleaning up"
docker rm -f "${CONTAINER_NAME}" 2>/dev/null || true
}
trap cleanup EXIT
echo "==> Waiting for container to be ready"
for i in {1..60}; do
if curl -sf "${HEALTH_URL}" >/dev/null 2>&1; then
echo "==> Health check passed on attempt ${i}"
break
fi
if [ "$i" -eq 60 ]; then
echo "==> FAIL: /health did not respond in time"
docker logs "${CONTAINER_NAME}" || true
exit 1
fi
sleep 2
done
echo "==> Checking /openapi.json"
if curl -sf "${HEALTH_URL%/*}/openapi.json" | head -c 50 >/dev/null; then
echo "==> /openapi.json reachable"
else
echo "==> WARN: /openapi.json not reachable (non-fatal)"
fi
echo ""
echo "==> SUCCESS: Image ${IMAGE} is functional"
echo " Health: ${HEALTH_URL}"
echo ""