diff --git a/apps/docs/content/docs/core/applications/build-type.mdx b/apps/docs/content/docs/core/applications/build-type.mdx index a9f2fb0f..157bb90d 100644 --- a/apps/docs/content/docs/core/applications/build-type.mdx +++ b/apps/docs/content/docs/core/applications/build-type.mdx @@ -107,6 +107,39 @@ When you enable the Dockerfile build type, two additional fields become availabl +### Automatic Build Variables + +Dokploy automatically injects the following build-time variables into every build, across all builder types: + +| Variable | Description | +| :------------------------- | :------------------------------------------------ | +| `DOKPLOY_COMMIT_HASH` | The full git commit hash | +| `DOKPLOY_COMMIT_SHORT` | The short (7-char) git commit hash | +| `DOKPLOY_COMMIT_MESSAGE` | The commit message of the deployed commit | + +These variables allow you to track which exact commit is running inside a deployed container, useful for debugging, health endpoints, and observability. + +#### Usage with Dockerfile + +To make these available at runtime, add the following to your Dockerfile: + +```dockerfile +ARG DOKPLOY_COMMIT_HASH +ARG DOKPLOY_COMMIT_SHORT +ARG DOKPLOY_COMMIT_MESSAGE +ENV DOKPLOY_COMMIT_HASH=$DOKPLOY_COMMIT_HASH +ENV DOKPLOY_COMMIT_SHORT=$DOKPLOY_COMMIT_SHORT +ENV DOKPLOY_COMMIT_MESSAGE=$DOKPLOY_COMMIT_MESSAGE +``` + +#### Usage with Nixpacks, Heroku, Paketo, and Railpack + +For non-Dockerfile builders, these variables are automatically passed as environment variables during the build and are available at runtime without any extra configuration. + + + If the source is not a git repository (e.g., Docker image source), these variables will be set to `unknown`. + + ### Buildpack Dokploy supports two types of buildpacks: