From 87fb0b3e3875e85883948e234ecf0358c3428025 Mon Sep 17 00:00:00 2001 From: nurikk <1525421+nurikk@users.noreply.github.com> Date: Sun, 15 Mar 2026 14:17:39 +0000 Subject: [PATCH 1/3] 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 --- .../docs/core/applications/build-type.mdx | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/apps/docs/content/docs/core/applications/build-type.mdx b/apps/docs/content/docs/core/applications/build-type.mdx index a9f2fb0f..498207cd 100644 --- a/apps/docs/content/docs/core/applications/build-type.mdx +++ b/apps/docs/content/docs/core/applications/build-type.mdx @@ -107,6 +107,36 @@ 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 short git commit hash of the deployed commit | +| `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_MESSAGE +ENV DOKPLOY_COMMIT_HASH=$DOKPLOY_COMMIT_HASH +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: From 10e9e3a5bfffea5dc6df30d3c4083c191885a8f2 Mon Sep 17 00:00:00 2001 From: nurikk <1525421+nurikk@users.noreply.github.com> Date: Sun, 15 Mar 2026 14:24:47 +0000 Subject: [PATCH 2/3] docs: add DOKPLOY_COMMIT_HASH_LONG to build variables table --- .../content/docs/core/applications/build-type.mdx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/docs/content/docs/core/applications/build-type.mdx b/apps/docs/content/docs/core/applications/build-type.mdx index 498207cd..2c4865f2 100644 --- a/apps/docs/content/docs/core/applications/build-type.mdx +++ b/apps/docs/content/docs/core/applications/build-type.mdx @@ -111,10 +111,11 @@ When you enable the Dockerfile build type, two additional fields become availabl Dokploy automatically injects the following build-time variables into every build, across all builder types: -| Variable | Description | -| :------------------------- | :----------------------------------------------- | -| `DOKPLOY_COMMIT_HASH` | The short git commit hash of the deployed commit | -| `DOKPLOY_COMMIT_MESSAGE` | The commit message of the deployed commit | +| Variable | Description | +| :------------------------- | :------------------------------------------------ | +| `DOKPLOY_COMMIT_HASH` | The short (7-char) git commit hash | +| `DOKPLOY_COMMIT_HASH_LONG`| The full 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. @@ -124,8 +125,10 @@ To make these available at runtime, add the following to your Dockerfile: ```dockerfile ARG DOKPLOY_COMMIT_HASH +ARG DOKPLOY_COMMIT_HASH_LONG ARG DOKPLOY_COMMIT_MESSAGE ENV DOKPLOY_COMMIT_HASH=$DOKPLOY_COMMIT_HASH +ENV DOKPLOY_COMMIT_HASH_LONG=$DOKPLOY_COMMIT_HASH_LONG ENV DOKPLOY_COMMIT_MESSAGE=$DOKPLOY_COMMIT_MESSAGE ``` From 092378fdebcbee0eb4eae048c322ef4a0b6ad0fb Mon Sep 17 00:00:00 2001 From: nurikk <1525421+nurikk@users.noreply.github.com> Date: Sun, 15 Mar 2026 14:27:42 +0000 Subject: [PATCH 3/3] docs: rename DOKPLOY_COMMIT_HASH_LONG to DOKPLOY_COMMIT_HASH, old DOKPLOY_COMMIT_HASH to DOKPLOY_COMMIT_SHORT --- apps/docs/content/docs/core/applications/build-type.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/docs/content/docs/core/applications/build-type.mdx b/apps/docs/content/docs/core/applications/build-type.mdx index 2c4865f2..157bb90d 100644 --- a/apps/docs/content/docs/core/applications/build-type.mdx +++ b/apps/docs/content/docs/core/applications/build-type.mdx @@ -113,8 +113,8 @@ Dokploy automatically injects the following build-time variables into every buil | Variable | Description | | :------------------------- | :------------------------------------------------ | -| `DOKPLOY_COMMIT_HASH` | The short (7-char) git commit hash | -| `DOKPLOY_COMMIT_HASH_LONG`| The full git commit hash | +| `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. @@ -125,10 +125,10 @@ To make these available at runtime, add the following to your Dockerfile: ```dockerfile ARG DOKPLOY_COMMIT_HASH -ARG DOKPLOY_COMMIT_HASH_LONG +ARG DOKPLOY_COMMIT_SHORT ARG DOKPLOY_COMMIT_MESSAGE ENV DOKPLOY_COMMIT_HASH=$DOKPLOY_COMMIT_HASH -ENV DOKPLOY_COMMIT_HASH_LONG=$DOKPLOY_COMMIT_HASH_LONG +ENV DOKPLOY_COMMIT_SHORT=$DOKPLOY_COMMIT_SHORT ENV DOKPLOY_COMMIT_MESSAGE=$DOKPLOY_COMMIT_MESSAGE ```