From 6e9cfebf84f47b160e95ad316707b95271243193 Mon Sep 17 00:00:00 2001 From: DatTT127 Date: Sat, 18 Jul 2026 22:02:43 +0700 Subject: [PATCH] update workflows-4 --- .gitea/workflows/backend-ecr-modal.yaml | 6 ++-- .../CODEBASE/backend/cv_inference_server.py | 5 +++- .../implementation/backend_deploy/Dockerfile | 2 +- .../backend_deploy/gitea_modal_build.py | 29 +------------------ 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/.gitea/workflows/backend-ecr-modal.yaml b/.gitea/workflows/backend-ecr-modal.yaml index 837828b..6247039 100644 --- a/.gitea/workflows/backend-ecr-modal.yaml +++ b/.gitea/workflows/backend-ecr-modal.yaml @@ -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: diff --git a/workspace/sprint_1_2/CODEBASE/backend/cv_inference_server.py b/workspace/sprint_1_2/CODEBASE/backend/cv_inference_server.py index eb1cb29..ff22d91 100644 --- a/workspace/sprint_1_2/CODEBASE/backend/cv_inference_server.py +++ b/workspace/sprint_1_2/CODEBASE/backend/cv_inference_server.py @@ -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 diff --git a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile index 430c9e0..69e80e7 100644 --- a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile +++ b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/Dockerfile @@ -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"] \ No newline at end of file diff --git a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py index bc25253..5ade8fb 100644 --- a/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py +++ b/workspace/sprint_1_2/CODEBASE/deps/implementation/backend_deploy/gitea_modal_build.py @@ -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}")