Deploy from your computer or CI with the th CLI

One command builds your folder and deploys it. You don’t need Docker on your computer.

Every th container command and parameter is in the CLI reference.

Install and sign in

Shell
# Linux, macOS
curl -fsSL https://raw.githubusercontent.com/mrzack99s/thailandhosting-cli/main/install.sh | sh
# Windows (PowerShell)
irm https://raw.githubusercontent.com/mrzack99s/thailandhosting-cli/main/install.ps1 | iex
# or with Go 1.23+
go install github.com/mrzack99s/thailandhosting-cli/cmd/th@latest

th auth login opens the Console. Check that the code matches your terminal, then click Approve. The sign-in lasts 90 days and is listed under Account → Sessions, where you can sign it out.

Shell
th auth login                     # opens the Console to approve
th config set project my-project  # optional: the CLI picks your first Project
th container deploy api --source .      # build this folder and deploy it

What --source does

  1. The CLI packs the folder, leaving out what .thignore, .dockerignore or .gitignore lists (and .git, node_modules), up to 100 MB.
  2. We build it. With a Dockerfile we use it; without one we write one for Node.js (package.json), Python (requirements.txt or pyproject.toml) or Go (go.mod) and show it in the build log so you can copy it. The log streams to your terminal.
  3. The image is kept in your Project’s registry and deployed as a new revision. The first deploy creates the Container; later ones keep its settings and change only what you pass.

Press Ctrl+C while it builds and the build keeps going on our side. Follow it with th builds log <id> --follow.

Deploy an image, change settings, roll back

Shell
th container deploy api --image ghcr.io/acme/api:1.4 --port 3000 \
  --cpu 1 --memory 512Mi --min-instances 0 --max-instances 5 \
  --set-env-vars NODE_ENV=production --secret-env API_KEY=xxxx
Shell
th container services list
th container services describe api
th container services logs api --lines 200
th container revisions list --service api
th container services update-traffic api --to-revision 3   # roll back
th container images list api      # images and what keeps them
th container images delete api:old-tag
th builds list
th builds log <build-id> --follow

Images you build or push are at registry.thailandhosting.com/<project>/<name>. You can also push with Docker:

Shell
th auth configure-docker   # docker login to our registry
docker build -t registry.thailandhosting.com/my-project/api:1.4 .
docker push registry.thailandhosting.com/my-project/api:1.4
th container deploy api --image registry.thailandhosting.com/my-project/api:1.4

The registry keeps images for the newest 10 revisions of each Container (older ones can no longer be rolled back to after 7 days) and anything you tagged. Each Project has 20 GB; you get an email at 80%. See and delete images with th container images list / th container images delete or in the Registry card on the Container’s page.

Deploy from GitHub Actions or another CI

In the Console, open Integrations → API keys and create a key with Containers: deploy (run:write). The key works only on the Containers, builds and registry of its Project. Save it as the secret TH_API_KEY.

Shell
# .github/workflows/deploy.yml
on: { push: { branches: [main] } }
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with: { go-version: '1.23' }
      - run: go install github.com/mrzack99s/thailandhosting-cli/cmd/th@latest
      - run: th container deploy api --source .
        env:
          TH_API_KEY: ${{ secrets.TH_API_KEY }}   # a key with the run:write scope

Builds and the registry are pay-as-you-go: the Project’s wallet needs money in it. The build server makes images for one CPU type: if your Container’s machine type uses another, build the image yourself with docker buildx --platform and deploy it with --image.

If something goes wrong

It says “ไม่พบ Dockerfile และไม่รู้จักชนิดโปรเจกต์” (No Dockerfile and the project type isn’t recognised)

Add a Dockerfile at the top of the folder, or deploy from the folder that holds package.json, go.mod or requirements.txt.

The build ends with exit code 137

The build ran out of memory. Make the build lighter, or build the image yourself and deploy it with --image.

The CLI says “Token ไม่ถูกต้องหรือหมดอายุ” (The token is invalid or expired)

Run th auth login again. In CI, check that the API key has the run:write scope and hasn’t expired.

Still stuck? Let our team help

Open a ticket from the Console. Tell us the site or service, what you did and the message on screen. Our reply comes back in the same ticket, so everything stays in one place.