diff --git a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml index 8b5a4d66..58218619 100644 --- a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml +++ b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml @@ -154,18 +154,26 @@ spec: echo "Building service: $service" echo "===================================================================" - # Determine Dockerfile path and image name + # Determine Dockerfile path, context path, and image name # Folder names are: auth, tenant, gateway, frontend, alert_processor, etc. # Image names MUST match what's in the Kubernetes manifests exactly # The manifests use the folder name directly (with underscores preserved) + # + # CONTEXT_PATH is important - some Dockerfiles expect the context to be their directory + # (e.g., frontend expects context=frontend/), while services expect context=workspace root if [ "$service" = "gateway" ]; then DOCKERFILE_PATH="$WORKSPACE/gateway/Dockerfile" + CONTEXT_PATH="$WORKSPACE" IMAGE_NAME="gateway" elif [ "$service" = "frontend" ]; then + # Frontend Dockerfile expects context to be the frontend/ directory + # because it does COPY package*.json ./ and COPY nginx.conf etc. DOCKERFILE_PATH="$WORKSPACE/frontend/Dockerfile.kubernetes" + CONTEXT_PATH="$WORKSPACE/frontend" IMAGE_NAME="frontend" else DOCKERFILE_PATH="$WORKSPACE/services/$service/Dockerfile" + CONTEXT_PATH="$WORKSPACE" # Use folder name directly - matches manifest image references # e.g., auth, tenant, ai_insights, alert_processor, demo_session, external IMAGE_NAME="$service" @@ -191,10 +199,11 @@ spec: sleep 10 fi + echo "Context: $CONTEXT_PATH" if /kaniko/executor \ --dockerfile="$DOCKERFILE_PATH" \ --destination="$(params.registry)/$IMAGE_NAME:$(params.git-revision)" \ - --context="$WORKSPACE" \ + --context="$CONTEXT_PATH" \ --build-arg="BASE_REGISTRY=$(params.base-registry)" \ --build-arg="PYTHON_IMAGE=$(params.python-image)" \ --cache=true \