Skip to Content
CLI & APICommand reference

stackblaze up

Deploy a folder (default - cwd) - git checkout → build the repo; no git remote or --local → upload the folder; --image → run an image

Usage: stackblaze up [options] [path]

Deploy a folder (default: cwd): git checkout → build the repo; no git remote or
--local → upload the folder; --image → run an image

Options:
  --api-url <url>           StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>           API token, sb_pat_... (env STACKBLAZE_TOKEN)
  --name <name>             App name (default: linked app or directory name)
  -a, --app <name>          Same as --name
  --image <ref>             Docker image, e.g. nginx:1.27,
                            ghcr.io/acme/web@sha256:… (skips git detection)
  --tag <tag>               Image tag when --image has none (default: latest)
  --repository <url>        Git repository URL override
  --branch <name>           Git branch override
  --buildstrategy <s>       railpack, dockerfile, buildpacks, or plain
  --build-context <dir>     Mono-repo build context
  --dockerfile-path <path>  Dockerfile path
  --path <dir>              Deploy a subdirectory (monorepo path)
  --path-as-root            Treat --path as the build root (Dockerfile paths
                            relative to it) (default: false)
  --local                   Upload the folder instead of building its git
                            remote (default: false)
  --verbose                 Print extra deploy diagnostics (default: false)
  --port <n>                Container port (new apps: default = the Dockerfile
                            EXPOSE port, else 3000)
  --worker                  Background worker: no port, no public URL (default:
                            false)
  --replicas <n>            Web/worker instances
  --domain <host>           Custom domain
  --env <pair>              KEY=value (repeatable)
  -m, --message <text>      Release message shown in the deployments timeline
  --wait                    Poll until running (default: false)
  --timeout <seconds>       Max --wait time (default 600)
  --ci                      CI mode: stream build logs as NDJSON and exit when
                            build finishes (default: false)
  -d, --detach              Start deploy and exit without waiting (default:
                            false)
  -y, --yes                 Auto-create project from directory name if unlinked
                            (default: false)
  --new                     Force new project from directory name (default:
                            false)
  --resume                  Resume the paused linked app instead of deploying
                            (same as `stackblaze resume`) (default: false)
  --json                    Output JSON (default: false)
  -p, --project <name>      Project name
  --phase <name>            Environment name (--env sets variables here)
  -o, --output <format>     Output format: text or json (choices: "text",
                            "json")
  -h, --help                Print help

Re-running up is safe (CI on every push): an existing app is updated with
the flags you pass and redeployed — a new build for git / local apps, a
re-pull (or the new --tag) for image apps. Detected settings (Dockerfile
port, build strategy) only apply when the app is first created.

Local folders: with no git remote (or --local), up packs the folder
(.gitignore and .stackblazeignore are honoured; .git,
node_modules and .env* are always left out — a warning names any .env it
skipped), uploads it (progress on stderr) and builds it. Limit 200 MB
compressed. Later rebuilds (variable changes, Redeploy) reuse the upload
for 7 days.

Image apps: --image takes a full reference ([registry[:port]/]name[:tag]
[@sha256:…]). A tag in --image and --tag must agree (a mismatch is an
error); without either the tag is latest. Without --port, up reads the
image's EXPOSE port; with none it
deploys a web service on 3000 and warns. --worker deploys a background
process instead.

Builds: after the deploy starts, up attaches to the build's live log
stream (WebSocket) and prints each line as the build writes it — the same
stream as `stackblaze builds logs -f`. Older servers without the stream are
followed by polling instead (automatic). It exits when the build finishes;
exit code 1 when the build fails (or stays Unknown for 30s). --detach skips
the stream.

--ci prints NDJSON on stdout: deploy, build (state changes), log (build,
container, message), status and error events; notices and upload progress
go to stderr. Image deploys without --wait end with {"type":"status",
"state":"submitted","ready":null}. Set STACKBLAZE_BUILD_STREAM=poll to force
polling.

--json (without --ci) prints ONE JSON document when up finishes: the
deploy result, plus "build" (the followed build) and, with --wait, "wait".
Build log lines go to stderr.

Commit: rebuilding an existing git app pins the build to the commit being
deployed — the PR head SHA on GitHub pull_request events (from
GITHUB_EVENT_PATH), else GITHUB_SHA; CI_MERGE_REQUEST_SOURCE_BRANCH_SHA or
CI_COMMIT_SHA on GitLab; BUILDKITE_COMMIT; otherwise git rev-parse HEAD
unless that commit is not pushed. Not pinned when --branch / --repository
point elsewhere; a new app's first build uses the branch head.

Examples:
  stackblaze up                     # git checkout → build; else upload cwd
  stackblaze up ./api --local       # upload ./api even though it is in git
  stackblaze up --image nginx:1.27    # same as --image nginx --tag 1.27
  stackblaze up --ci --wait         # CI: NDJSON, exit 1 on failure

Example

Deploy a local folder with a Dockerfile. It isn't a git checkout, so up packs and uploads it, builds it, and with --wait waits until the new app is running. The app is named after the folder.

cd shop-api
stackblaze up -p github-demo-cw8z --phase stage --wait -m "First deploy"
Packing <path>/shop-api: 2 files, 114 B (respects .gitignore and .stackblazeignore)
Archive: 218 B compressed (sha256 3168282b2f52)
port 8080 (EXPOSE in Dockerfile; pass --port <n> to change it)
Uploading: 100% (218 B/218 B)
OK Building github-demo-cw8z/stage/shop-api from local upload 3168282b2f52
build shop-api-nhi0-github-demo-cw8z-20261125-150407-b690 (Unknown)
build shop-api-nhi0-github-demo-cw8z-20261125-150407-b690 → Active
[fetch] ========== fetch uploaded source (sha256 3168282b2f52a5ed42f840c32977942d09bf647c534ef276bf46518e2144f3ae)
[fetch] downloaded 218 bytes
…
[push] STEP 1/3: FROM nginxinc/nginx-unprivileged:1.27-alpine
…
[push] Writing manifest to image destination
…
build shop-api-nhi0-github-demo-cw8z-20261125-150407-b690 → Succeeded
Waiting for github-demo-cw8z/stage/shop-api-nhi0 to be ready (up to 10m00s)…
OK github-demo-cw8z/stage/shop-api-nhi0 is ready
url: https://shop-api-nhi0.cloud-dev-central-1.stackblaze.app

On this page