update workflows-4
This commit is contained in:
@@ -88,14 +88,14 @@ jobs:
|
||||
modal token set --token-id ${{ env.MODAL_TOKEN_ID }} \
|
||||
--token-secret ${{ env.MODAL_TOKEN_SECRET }}
|
||||
modal run ${{ env.MODAL_SCRIPT }} \
|
||||
--registry ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }} \
|
||||
--image-name "" \
|
||||
--registry ${{ env.ECR_REGISTRY }} \
|
||||
--image-name ${{ env.ECR_REPOSITORY }} \
|
||||
--tag ${{ steps.tag.outputs.tag }} \
|
||||
--platform linux/amd64 \
|
||||
--push
|
||||
|
||||
notify-deploy:
|
||||
needs: modal-build
|
||||
needs: build-and-push
|
||||
if: success() && github.event_name == 'push'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@@ -42,7 +42,10 @@ logger = logging.getLogger(__name__)
|
||||
async def lifespan(app: FastAPI):
|
||||
|
||||
if not settings.triton_endpoint:
|
||||
raise RuntimeError("TRITON_ENDPOINT is not set. Set it via environment variable.")
|
||||
logger.warning("TRITON_ENDPOINT is not set. Triton-dependent features disabled.")
|
||||
yield
|
||||
return
|
||||
|
||||
logger.info("Starting CV inference service on Triton: %s", settings.triton_endpoint)
|
||||
from backend.services.triton_warmup import warmup_triton_models
|
||||
|
||||
|
||||
@@ -114,5 +114,5 @@ EXPOSE 8001
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8001/health')" || exit 1
|
||||
|
||||
# Run the CV inference server
|
||||
# # Run the CV inference server
|
||||
ENTRYPOINT ["python", "-m", "backend.cv_inference_server"]
|
||||
@@ -77,8 +77,6 @@ app = modal.App(APP_NAME, image=backend_image)
|
||||
memory=8192, # 8GB RAM - plenty for wheel building
|
||||
secrets=[
|
||||
modal.Secret.from_name("aws-secrets"), # AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION
|
||||
# modal.Secret.from_name("dockerhub-credentials"), # DOCKERHUB_USERNAME, DOCKERHUB_TOKEN (optional)
|
||||
# modal.Secret.from_name("gcp-artifact-registry"), # GCP credentials (optional)
|
||||
],
|
||||
)
|
||||
def build_and_push(
|
||||
@@ -189,19 +187,6 @@ def _authenticate_registry(registry: str, client):
|
||||
], check=True, capture_output=True)
|
||||
# Note: Modal's aws-ecr-credentials secret should handle this via env vars
|
||||
|
||||
elif "docker.io" in registry or "index.docker.io" in registry or "/" not in registry.split("/")[0]:
|
||||
# Docker Hub
|
||||
username = os.getenv("DOCKERHUB_USERNAME")
|
||||
password = os.getenv("DOCKERHUB_TOKEN")
|
||||
if username and password:
|
||||
print("Authenticating with Docker Hub...")
|
||||
client.login(username=username, password=password)
|
||||
|
||||
elif "gcr.io" in registry or "pkg.dev" in registry:
|
||||
# Google Container Registry / Artifact Registry
|
||||
print("Authenticating with GCP Artifact Registry...")
|
||||
subprocess.run(["gcloud", "auth", "configure-docker", "--quiet"], check=True)
|
||||
|
||||
|
||||
@app.function(
|
||||
image=backend_image,
|
||||
@@ -218,14 +203,6 @@ def test_image(registry: str, image_name: str, tag: str) -> dict:
|
||||
print(f"Pulling {full_image} for testing...")
|
||||
client.images.pull(full_image)
|
||||
|
||||
# print("Running health check...")
|
||||
# output = client.containers.run(
|
||||
# full_image,
|
||||
# command=["python", "-c", "import backend.cv_inference_server; print('Import OK')"],
|
||||
# remove=True,
|
||||
# detach=False,
|
||||
# )
|
||||
|
||||
print("Running basic smoke test...")
|
||||
output = client.containers.run(
|
||||
full_image,
|
||||
@@ -233,15 +210,11 @@ def test_image(registry: str, image_name: str, tag: str) -> dict:
|
||||
"python", "-c",
|
||||
"import sys; print('Python', sys.version); "
|
||||
"import cv2; print('OpenCV', cv2.__version__); "
|
||||
# "import backend.cv_inference_server; print('Import OK')",
|
||||
],
|
||||
remove=True,
|
||||
detach=False,
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
return {
|
||||
"status": "healthy",
|
||||
"output": output.decode().strip(),
|
||||
@@ -274,7 +247,7 @@ def main(
|
||||
test: Run health check after build (default: false)
|
||||
"""
|
||||
print("=" * 60)
|
||||
print("VKIST Backend Docker Build on Modal")
|
||||
print("MSK-Lumina Backend Docker Build on Modal")
|
||||
print("=" * 60)
|
||||
print(f"Registry: {registry}")
|
||||
print(f"Image: {image_name}")
|
||||
|
||||
Reference in New Issue
Block a user