cli icon indicating copy to clipboard operation
cli copied to clipboard

Hardcode TF version to v1.13.4 for Docker build

Open pietern opened this issue 4 weeks ago • 1 comments
trafficstars

Example how to use a later TF version in a Docker build.

Prerequisites

  • Go 1.25+ installed
  • Docker installed

Steps

1. Build the CLI binary

Build a static binary that can run in Alpine Linux:

CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o databricks

2. Build the Docker image

Build the Docker image with the desired architecture:

# For amd64
docker build -t databricks-cli --build-arg ARCH=amd64 .

# For arm64
docker build -t databricks-cli --build-arg ARCH=arm64 .

3. Verify the build

Test that the image works:

docker run --rm databricks-cli version

Notes

  • The static binary (CGO_ENABLED=0) is required because the Docker image uses Alpine Linux with musl libc
  • The Docker image includes Terraform v1.13.4 and the Databricks Terraform provider
  • Environment variables are pre-configured in the image:
    • DATABRICKS_TF_VERSION=1.13.4
    • DATABRICKS_TF_EXEC_PATH=/app/bin/terraform

pietern avatar Oct 21 '25 10:10 pietern