Skip to content

Commit 87fb0b3

Browse files
committed
docs: document automatic DOKPLOY_COMMIT_HASH and DOKPLOY_COMMIT_MESSAGE build variables
Adds documentation for the new automatic build variables that Dokploy injects during Docker builds, covering usage across all builder types. Related: Dokploy/dokploy#4006, Dokploy/dokploy#4007
1 parent baeea6d commit 87fb0b3

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

apps/docs/content/docs/core/applications/build-type.mdx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,36 @@ When you enable the Dockerfile build type, two additional fields become availabl
107107

108108

109109

110+
### Automatic Build Variables
111+
112+
Dokploy automatically injects the following build-time variables into every build, across all builder types:
113+
114+
| Variable | Description |
115+
| :------------------------- | :----------------------------------------------- |
116+
| `DOKPLOY_COMMIT_HASH` | The short git commit hash of the deployed commit |
117+
| `DOKPLOY_COMMIT_MESSAGE` | The commit message of the deployed commit |
118+
119+
These variables allow you to track which exact commit is running inside a deployed container, useful for debugging, health endpoints, and observability.
120+
121+
#### Usage with Dockerfile
122+
123+
To make these available at runtime, add the following to your Dockerfile:
124+
125+
```dockerfile
126+
ARG DOKPLOY_COMMIT_HASH
127+
ARG DOKPLOY_COMMIT_MESSAGE
128+
ENV DOKPLOY_COMMIT_HASH=$DOKPLOY_COMMIT_HASH
129+
ENV DOKPLOY_COMMIT_MESSAGE=$DOKPLOY_COMMIT_MESSAGE
130+
```
131+
132+
#### Usage with Nixpacks, Heroku, Paketo, and Railpack
133+
134+
For non-Dockerfile builders, these variables are automatically passed as environment variables during the build and are available at runtime without any extra configuration.
135+
136+
<Callout type="info">
137+
If the source is not a git repository (e.g., Docker image source), these variables will be set to `unknown`.
138+
</Callout>
139+
110140
### Buildpack
111141

112142
Dokploy supports two types of buildpacks:

0 commit comments

Comments
 (0)