Docs/Deploy/Deploy with the CLI

Deploy with the CLI

4 min read
On this page

The dokwe CLI deploys straight from your working directory. You don't need a GitHub repository: Dokwe runs its own git server, and dokwe deploy pushes your code there and streams the build log back to you.

Install and log in#

macOS / Linux
curl -sSL https://dokwe.com/install-cli.sh | bash

Then log in:

bash
dokwe login

Deploy a new project without GitHub#

  1. Create the project#

    From your project folder, run:

    bash
    dokwe create my-app

    When asked for a GitHub repo URL, leave it blank to deploy with the CLI. If you enter a URL instead, the CLI also asks for a branch (default main).

    dokwe create links the current directory to the new project by writing a .dokwe file.

  2. Deploy#

    bash
    dokwe deploy

    Run dokwe check first to catch what would break the build, and dokwe security to scan the code for security problems on your machine.

What dokwe deploy does#

  1. Runs git init if the folder isn't a git repository yet.
  2. If there are uncommitted changes, stages everything and commits it with the message Deploy via dokwe CLI.
  3. Force-pushes your current HEAD to the main branch of the project's repository on Dokwe's git server, at /git/<slug>.git. Your login token authenticates the push.
  4. Waits for the deployment that the push starts, then streams its build log until it finishes.

If nothing changed since your last push, the CLI starts a fresh deployment of the existing code instead.

dokwe deploy commits every change in the folder and force-pushes. Check git status first if you don't want everything included.

Deploy a GitHub-connected project#

For a project that builds from GitHub, use the --from-git flag. It asks Dokwe to deploy from the connected repository and streams the build log, without pushing local code:

bash
dokwe deploy --from-git

On a GitHub-connected project, dokwe deploy stops and explains your options instead of uploading your local folder. Use dokwe deploy --from-git to deploy the latest commit from GitHub, dokwe push to commit and push to GitHub, or dokwe deploy --switch-to-cli to move the project to CLI deploys on purpose. After switching, GitHub pushes no longer deploy the project until you reconnect the repository in the project's settings.

Before it pushes, dokwe deploy tells you what it's doing: it commits any changed files (git add -A) unless you pass --no-commit, then force-pushes that commit to Dokwe's built-in git as main. Your local branches and other remotes aren't touched.

If you already have a project, link a folder to it:

bash
dokwe link

The CLI lists your projects and asks you to choose one. Most commands use this link. To target another project for one command, pass --project (or -p) with a project ID or slug:

bash
dokwe deploy --project my-app

Clone a project with dokwe pull#

dokwe pull clones a project using credentials Dokwe provides, so you don't need to set up GitHub access on your machine. It works for both GitHub-backed projects and projects on Dokwe's git server.

bash
dokwe pull my-app

Run it without an argument to pick from a list. The CLI clones into a folder named after the slug, checks out the project's branch, removes the token from the saved remote, and writes the .dokwe link.

If the project is already cloned, dokwe pull fast-forwards it instead. If that fails because of local changes or a diverged branch, resolve them and run git pull yourself.

Clone part of a large repository#

For big monorepos, clone only the paths you work on:

bash
dokwe pull my-app --path apps/frontend --path libs

--path turns on sparse checkout and implies --filter=blob:none. Pass --filter on its own (for example --filter blob:none) to keep the full tree but fetch file contents on demand.

Change the sparse paths later with dokwe sparse:

CommandWhat it does
dokwe sparse listShow the active paths.
dokwe sparse set <path>...Replace the paths.
dokwe sparse add <path>...Add paths.
dokwe sparse remove <path>...Remove paths.
dokwe sparse disableCheck out the full tree.
dokwe sparse reapplyRebuild the working tree from the current settings.

Commit and push with dokwe push#

dokwe push stages, commits, and pushes your changes to the project's repository. The push starts a deployment: through the webhook for a GitHub repository, or directly for a repository on Dokwe's git server.

bash
dokwe push -m "Fix pricing page" -a
  • -m, --message sets the commit message. Without it, the CLI asks.
  • -a, --all stages all changes without asking.

The CLI pushes your current branch with short-lived credentials, then restores the clean remote URL. If the branch has no upstream yet, it sets one. Run dokwe logs --build to watch the build.

Preview locally with dokwe serve#

dokwe serve builds a Docker image of the current folder on your machine, runs it, and gives you a temporary public URL on preview.dokwe.com. The URL works while the command runs. Press Ctrl+C to stop the container and close the tunnel.

bash
dokwe serve --port 8080
FlagDefaultMeaning
--port3000Port your app listens on inside the container.
--skip-buildoffSkip the Docker build and use an existing image.
--imageauto-generatedImage tag to build or use.

You need Docker installed locally. If there's no Dockerfile, the CLI tries to detect your stack and offers to write one.

Next steps#