Build and Deploy from Git

Who this is for

Users running git-source apps who want to understand how builds and deploys work, how to trigger them, and what options are available.


How Git-Source App Deploys Work

For apps with source: git, CloudAIPilot:

  1. SSH-es to the server.
  2. Clones or pulls the git repository.
  3. Builds a Docker image from the Dockerfile in the repo.
  4. Runs the new image, replacing the previous container.

For Compose+Git apps: pulls the repo and runs docker compose up -d.


Trigger a Deploy

Manual deploy

  1. Open the app detail.
  2. Click Deploy (or Redeploy).
  3. Optionally specify a specific git commit SHA in the Git ref field.
  4. Click Deploy.

Auto-deploy via webhook

  1. In the app's Git tab, copy the Webhook URL.
  2. Add it to your git repository as a webhook (push event).
  3. Every push to the configured branch triggers a new deploy automatically.

See KB-03-08: Git Settings and Webhook Deploy for detailed webhook setup steps (the process is the same for apps).


Build Configuration

FieldDescriptionDefault
Dockerfile pathPath to Dockerfile in the repoDockerfile
Git branchBranch to build fromas set at creation
Git refOptional specific commit SHA for targeted deploylatest on branch

If your Dockerfile is not in the root of the repo, update the Dockerfile path field in the app's Git settings.


Build Process on the Server

CloudAIPilot runs:

git clone <repoUrl> --branch <gitBranch> /opt/cloudpilot/apps/<appId>/
cd /opt/cloudpilot/apps/<appId>/
docker build -t cloudpilot-app-<appId>:latest -f <dockerfilePath> .
docker stop <appId> && docker rm <appId>
docker run -d --name <appId> ... cloudpilot-app-<appId>:latest

Build logs are streamed in real time to the Activity Center.


Zero-Downtime Deploys

If zeroDowntimeEnabled is true and the app has a custom domain configured, CloudAIPilot performs a blue-green swap:

  1. Builds and starts the new container on a temporary port.
  2. Waits for the healthcheck to pass.
  3. Updates the Nginx proxy to point to the new container.
  4. Stops the old container.

This requires the healthPath to be configured on the app.


What Success Looks Like

After a deploy, the app's commitSha field updates to the latest commit. The Activity Center shows the build and run steps as completed. The app status shows running.


Common Issues and Fixes

IssueLikely causeFix
Build fails: "Dockerfile not found"Wrong Dockerfile pathUpdate the path in the app's Git settings.
Build fails: "permission denied to repo"Deploy key missing or expiredReconnect the git account or re-add the deploy key.
Container fails after buildApp crashes on startCheck logs — see KB-04-12: App Logs.
Webhook not triggeringIncorrect webhook URL or secretRe-copy from CloudAIPilot and update in git provider.

Related Articles