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:
- SSH-es to the server.
- Clones or pulls the git repository.
- Builds a Docker image from the
Dockerfilein the repo. - 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
- Open the app detail.
- Click Deploy (or Redeploy).
- Optionally specify a specific git commit SHA in the Git ref field.
- Click Deploy.
Auto-deploy via webhook
- In the app's Git tab, copy the Webhook URL.
- Add it to your git repository as a webhook (push event).
- 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
| Field | Description | Default |
|---|---|---|
| Dockerfile path | Path to Dockerfile in the repo | Dockerfile |
| Git branch | Branch to build from | as set at creation |
| Git ref | Optional specific commit SHA for targeted deploy | latest 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:
- Builds and starts the new container on a temporary port.
- Waits for the healthcheck to pass.
- Updates the Nginx proxy to point to the new container.
- 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
| Issue | Likely cause | Fix |
|---|---|---|
| Build fails: "Dockerfile not found" | Wrong Dockerfile path | Update the path in the app's Git settings. |
| Build fails: "permission denied to repo" | Deploy key missing or expired | Reconnect the git account or re-add the deploy key. |
| Container fails after build | App crashes on start | Check logs — see KB-04-12: App Logs. |
| Webhook not triggering | Incorrect webhook URL or secret | Re-copy from CloudAIPilot and update in git provider. |
Related Articles
- KB-04-07: Use the Commit Picker
- KB-04-11: Deployment History and Rollback
- KB-04-12: App Logs and Diagnose
- KB-04-13: Healthcheck Behavior