Loading...
Loading...
Execute mcloud local build to reproduce a Cloud build on the local machine. Use when debugging a build-failed deployment without pushing to the tracked branch, iterating on a build fix, or testing build-variable changes locally. Requires Docker and must run inside the project's Git repo.
npx skill4agent add medusajs/medusa-agent-skills mcloud-localmcloud local buildbuild-failed--jsonlocal build0build-faileddeployment-failedmcloud logs --deployment <id>--docker-cache--type storefrontmcloud local build \
--organization <org-id> \
--project <project-id-or-handle> \
--environment <environment-handle>-o/--organization <id>-p/--project <id-or-handle>-e/--environment <handle>-t/--type <backend|storefront>backend--root-path <path>.--storefront-path <path>--type storefront--env-file <path>.env-v/--var <KEY=VALUE>--docker-cachefalse0<repository-name>:cloud-local-build-<commit-hash># Identify the failing deployment and the commit it built
DEPLOYMENT_ID=$(
mcloud deployments list --json \
| jq -r '[.[] | select(.backend_status == "build-failed")][0].id'
)
COMMIT=$(mcloud deployments get "$DEPLOYMENT_ID" --json | jq -r '.commit_hash')
git checkout "$COMMIT"
if mcloud local build; then
echo "Build succeeded locally; failure not reproducible from this commit."
else
echo "Build failed locally; inspect the streamed output for the failing step."
fi0mcloud environments trigger-build <env># Reproduce the backend build for the active context
mcloud local build
# Reproduce the storefront build
mcloud local build --type storefront --storefront-path apps/storefront
# Test a build-variable fix without editing code
mcloud local build --var NODE_ENV=production
# Build against a local .env file
mcloud local build --env-file .env
# Reuse the Docker cache for a faster rebuild
mcloud local build --docker-cache