-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Docker Images #8671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chaptersix
wants to merge
13
commits into
main
Choose a base branch
from
alex/docker-image-re-v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+622
−0
Open
Add Docker Images #8671
Changes from 11 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3859167
Add Server and Admin tools images and local build tooling
chaptersix 7537a07
Update new server Dockerfile to use new config loading.
chaptersix 67d2afb
Refactor and address PR comments from Cusor.
chaptersix 3c2e49b
Merge branch 'main' into alex/docker-image-re-v2
chaptersix 06557a1
add es tool to new image
chaptersix 923bee5
update new entrypoint script to use sh arg and small tweak to downloa…
chaptersix e2918ef
Update .github/docker/scripts/sh/entrypoint.sh
chaptersix e6e79f7
Apply suggestions from code review
chaptersix 8458753
Merge branch 'main' into alex/docker-image-re-v2
chaptersix 2696141
remove scripts that are no longer needed and refactor
chaptersix 16caecf
fix tmp binaries causing large image size
chaptersix dd978c5
rm alpine_image default arg
chaptersix 995388e
Merge branch 'main' into alex/docker-image-re-v2
chaptersix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| SERVER_VERSION ?= 1.29.1 | ||
| CLI_VERSION ?= 1.5.0 | ||
| TCTL_VERSION ?= 1.18.4 | ||
| IMAGE_REPO ?= temporaliotest | ||
| TAG_LATEST ?= false | ||
|
|
||
| TEMPORAL_SHA := $(shell git rev-parse HEAD) | ||
| IMAGE_SHA_TAG := $(shell git rev-parse --short HEAD) | ||
| IMAGE_BRANCH_TAG := $(shell git rev-parse --abbrev-ref HEAD) | ||
| ALPINE_IMAGE ?= alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 | ||
|
|
||
| BAKE_ENV := SERVER_VERSION=$(SERVER_VERSION) \ | ||
| CLI_VERSION=$(CLI_VERSION) \ | ||
| TCTL_VERSION=$(TCTL_VERSION) \ | ||
| IMAGE_REPO=$(IMAGE_REPO) \ | ||
| IMAGE_SHA_TAG=$(IMAGE_SHA_TAG) \ | ||
| IMAGE_BRANCH_TAG=$(IMAGE_BRANCH_TAG) \ | ||
| TEMPORAL_SHA=$(TEMPORAL_SHA) \ | ||
| TAG_LATEST=$(TAG_LATEST) \ | ||
| ALPINE_IMAGE=$(ALPINE_IMAGE) | ||
|
|
||
| .PHONY: build-tools | ||
| build-admin-tools: | ||
| ./build-from-source.sh $(CLI_VERSION) amd64 $(TEMPORAL_SHA) | ||
| ./build-from-source.sh $(CLI_VERSION) arm64 $(TEMPORAL_SHA) | ||
| $(BAKE_ENV) docker buildx bake admin-tools | ||
|
|
||
| .PHONY: build-admin-tools-legacy | ||
| build-admin-tools-legacy: | ||
| ./download-binaries.sh $(SERVER_VERSION) $(CLI_VERSION) $(TCTL_VERSION) amd64 | ||
| ./download-binaries.sh $(SERVER_VERSION) $(CLI_VERSION) $(TCTL_VERSION) arm64 | ||
| ./copy-schema.sh | ||
| $(BAKE_ENV) docker buildx bake legacy-admin-tools | ||
|
|
||
| .PHONY: build-server | ||
| build-server: | ||
| ./build-from-source.sh $(CLI_VERSION) amd64 $(TEMPORAL_SHA) | ||
| ./build-from-source.sh $(CLI_VERSION) arm64 $(TEMPORAL_SHA) | ||
| $(BAKE_ENV) docker buildx bake server | ||
|
|
||
| .PHONY: build-server-legacy | ||
| build-server-legacy: | ||
| ./download-binaries.sh $(SERVER_VERSION) $(CLI_VERSION) $(TCTL_VERSION) amd64 | ||
| ./download-binaries.sh $(SERVER_VERSION) $(CLI_VERSION) $(TCTL_VERSION) arm64 | ||
| $(BAKE_ENV) docker buildx bake legacy-server | ||
|
|
||
| .PHONY: push | ||
| push: | ||
| ./download-binaries.sh $(SERVER_VERSION) $(CLI_VERSION) $(TCTL_VERSION) amd64 | ||
| ./download-binaries.sh $(SERVER_VERSION) $(CLI_VERSION) $(TCTL_VERSION) arm64 | ||
| ./copy-schema.sh | ||
| $(BAKE_ENV) docker buildx bake --push | ||
|
|
||
| .PHONY: clean | ||
| clean: | ||
| rm -rf ./build | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Build binaries from source by cloning temporal repo at specific SHA using goreleaser | ||
| # Usage: ./build-from-source.sh <cli-version> <arch> [temporal-sha] | ||
| # Example: ./build-from-source.sh 1.5.0 amd64 | ||
| # Example: ./build-from-source.sh 1.5.0 amd64 abc123def456 | ||
|
|
||
| CLI_VERSION="${1:?CLI version required (e.g., 1.5.0)}" | ||
| ARCH="${2:-amd64}" | ||
| # Default to latest commit on main if not specified | ||
| TEMPORAL_SHA="${3:-$(git ls-remote https://github.com/temporalio/temporal.git HEAD | awk '{print $1}')}" | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| BUILD_DIR="${SCRIPT_DIR}/build/${ARCH}" | ||
| TEMP_DIR="${SCRIPT_DIR}/build/temp" | ||
| TEMPORAL_CLONE_DIR="${SCRIPT_DIR}/build/temporal" | ||
|
|
||
| echo "Building binaries from source for ${ARCH}..." | ||
| echo " Temporal SHA: ${TEMPORAL_SHA}" | ||
| echo " CLI version: ${CLI_VERSION}" | ||
|
|
||
| # Create build directories | ||
| mkdir -p "${BUILD_DIR}" | ||
| mkdir -p "${TEMP_DIR}" | ||
|
|
||
| # Clone temporal repo at specific SHA (only once, not per architecture) | ||
| if [ ! -d "${TEMPORAL_CLONE_DIR}/.git" ]; then | ||
| echo "Cloning temporal repository at SHA ${TEMPORAL_SHA}..." | ||
| rm -rf "${TEMPORAL_CLONE_DIR}" | ||
| git clone https://github.com/temporalio/temporal.git "${TEMPORAL_CLONE_DIR}" | ||
| cd "${TEMPORAL_CLONE_DIR}" | ||
| git checkout "${TEMPORAL_SHA}" | ||
| else | ||
| echo "Using existing temporal clone at ${TEMPORAL_CLONE_DIR}" | ||
| cd "${TEMPORAL_CLONE_DIR}" | ||
| # Ensure we're at the correct SHA | ||
| CURRENT_SHA=$(git rev-parse HEAD) | ||
| if [ "${CURRENT_SHA}" != "${TEMPORAL_SHA}" ]; then | ||
| echo "Updating temporal clone to SHA ${TEMPORAL_SHA}..." | ||
| git fetch origin | ||
| git checkout "${TEMPORAL_SHA}" | ||
| fi | ||
| fi | ||
|
|
||
| # Verify elasticsearch tool exists | ||
| if [ ! -d "./cmd/tools/elasticsearch" ]; then | ||
| echo "Error: temporal-elasticsearch-tool source not found at ./cmd/tools/elasticsearch" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Build temporal server binaries individually using goreleaser | ||
| echo "Building temporal binaries with goreleaser for linux/${ARCH}..." | ||
| # Use goreleaser v1 if available in /tmp, otherwise use system goreleaser | ||
| GORELEASER_BIN="goreleaser" | ||
| if [ -f "/tmp/goreleaser" ]; then | ||
| GORELEASER_BIN="/tmp/goreleaser" | ||
| fi | ||
|
|
||
| # Build each binary individually with --single-target and --id | ||
| # Set GOOS and GOARCH to ensure we build for Linux | ||
| echo "Building temporal-server..." | ||
| GOOS=linux GOARCH=${ARCH} ${GORELEASER_BIN} build --single-target --id temporal-server --output "${BUILD_DIR}/temporal-server" --snapshot --clean | ||
|
|
||
| echo "Building temporal-cassandra-tool..." | ||
| GOOS=linux GOARCH=${ARCH} ${GORELEASER_BIN} build --single-target --id temporal-cassandra-tool --output "${BUILD_DIR}/temporal-cassandra-tool" --snapshot --clean | ||
|
|
||
| echo "Building temporal-sql-tool..." | ||
| GOOS=linux GOARCH=${ARCH} ${GORELEASER_BIN} build --single-target --id temporal-sql-tool --output "${BUILD_DIR}/temporal-sql-tool" --snapshot --clean | ||
|
|
||
| echo "Building temporal-elasticsearch-tool..." | ||
| GOOS=linux GOARCH=${ARCH} ${GORELEASER_BIN} build --single-target --id temporal-elasticsearch-tool --output "${BUILD_DIR}/temporal-elasticsearch-tool" --snapshot --clean | ||
|
|
||
| echo "Building tdbg..." | ||
| GOOS=linux GOARCH=${ARCH} ${GORELEASER_BIN} build --single-target --id tdbg --output "${BUILD_DIR}/tdbg" --snapshot --clean | ||
|
|
||
| # Download temporal CLI from releases (separate repository) | ||
| echo "Downloading temporal CLI..." | ||
| curl -fsSL "https://github.com/temporalio/cli/releases/download/v${CLI_VERSION}/temporal_cli_${CLI_VERSION}_linux_${ARCH}.tar.gz" \ | ||
| | tar -xz -C "${BUILD_DIR}" temporal | ||
|
|
||
| # Schema is already available in the cloned repo at build/temporal/schema | ||
| # The Dockerfile expects it at ./build/temporal/schema which is where we cloned it | ||
| echo "Schema directory available at ${TEMPORAL_CLONE_DIR}/schema" | ||
|
|
||
|
|
||
| echo "Done building binaries for ${ARCH}" | ||
| ls -lh "${BUILD_DIR}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Copy schema directory from the repo root | ||
| # Usage: ./copy-schema.sh | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" | ||
| BUILD_DIR="${SCRIPT_DIR}/build" | ||
|
|
||
| echo "Copying schema directory..." | ||
|
|
||
| # Create build directory if it doesn't exist | ||
| mkdir -p "${BUILD_DIR}/temporal" | ||
|
|
||
| # Copy schema directory from repo root | ||
| cp -r "${REPO_ROOT}/schema" "${BUILD_DIR}/temporal/" | ||
|
|
||
| echo "Schema directory copied to ${BUILD_DIR}/temporal/schema" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| variable "SERVER_VERSION" { | ||
| default = "1.29.1" | ||
| } | ||
| variable "ALPINE_IMAGE" { | ||
| default = "alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412" | ||
| } | ||
|
|
||
|
|
||
| variable "CLI_VERSION" { | ||
| default = "1.5.0" | ||
| } | ||
|
|
||
| variable "TCTL_VERSION" { | ||
| default = "1.18.4" | ||
| } | ||
|
|
||
| variable "IMAGE_REPO" { | ||
| default = "temporaliotest" | ||
| } | ||
|
|
||
| variable "IMAGE_SHA_TAG" {} | ||
|
|
||
| variable "IMAGE_BRANCH_TAG" {} | ||
|
|
||
| variable "SAFE_IMAGE_BRANCH_TAG" { | ||
| default = join("-", [for c in regexall("[a-z0-9]+", lower(IMAGE_BRANCH_TAG)) : c]) | ||
| } | ||
|
|
||
| variable "TEMPORAL_SHA" { | ||
| default = "" | ||
| } | ||
|
|
||
| variable "TAG_LATEST" { | ||
| default = false | ||
| } | ||
|
|
||
| # Legacy targets (legacy-admin-tools, legacy-server) are for building images with server versions | ||
| # older than v1.27.0 (3 minor versions behind v1.30.0). Once support for pre-1.27.0 versions is | ||
| # no longer needed, these legacy targets can be removed and only the standard targets should be used. | ||
|
|
||
| target "admin-tools" { | ||
| dockerfile = "targets/admin-tools.Dockerfile" | ||
| tags = compact([ | ||
| "${IMAGE_REPO}/admin-tools:${IMAGE_SHA_TAG}", | ||
| "${IMAGE_REPO}/admin-tools:${SAFE_IMAGE_BRANCH_TAG}", | ||
| TAG_LATEST ? "${IMAGE_REPO}/admin-tools:latest" : "", | ||
| ]) | ||
| platforms = ["linux/amd64", "linux/arm64"] | ||
| args = { | ||
| ALPINE_IMAGE = "${ALPINE_IMAGE}" | ||
| } | ||
| labels = { | ||
| "org.opencontainers.image.title" = "admin-tools" | ||
| "org.opencontainers.image.description" = "Temporal admin tools" | ||
| "org.opencontainers.image.url" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.source" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.licenses" = "MIT" | ||
| "org.opencontainers.image.version" = "${SERVER_VERSION}" | ||
| "org.opencontainers.image.revision" = "${TEMPORAL_SHA}" | ||
| "org.opencontainers.image.created" = timestamp() | ||
| "com.temporal.server.version" = "${SERVER_VERSION}" | ||
| "com.temporal.cli.version" = "${CLI_VERSION}" | ||
| } | ||
| } | ||
|
|
||
| target "legacy-admin-tools" { | ||
| dockerfile = "targets/legacy-admin-tools.Dockerfile" | ||
| target = "temporal-admin-tools" | ||
| tags = compact([ | ||
| "${IMAGE_REPO}/admin-tools:${IMAGE_SHA_TAG}", | ||
| "${IMAGE_REPO}/admin-tools:${SAFE_IMAGE_BRANCH_TAG}", | ||
| TAG_LATEST ? "${IMAGE_REPO}/admin-tools:latest" : "", | ||
| ]) | ||
| platforms = ["linux/amd64", "linux/arm64"] | ||
| args = { | ||
| ALPINE_IMAGE = "${ALPINE_IMAGE}" | ||
| } | ||
| labels = { | ||
| "org.opencontainers.image.title" = "admin-tools" | ||
| "org.opencontainers.image.description" = "Temporal admin tools with database clients" | ||
| "org.opencontainers.image.url" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.source" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.licenses" = "MIT" | ||
| "org.opencontainers.image.version" = "${SERVER_VERSION}" | ||
| "org.opencontainers.image.revision" = "${TEMPORAL_SHA}" | ||
| "org.opencontainers.image.created" = timestamp() | ||
| "com.temporal.server.version" = "${SERVER_VERSION}" | ||
| "com.temporal.cli.version" = "${CLI_VERSION}" | ||
| "com.temporal.tctl.version" = "${TCTL_VERSION}" | ||
| } | ||
| } | ||
|
|
||
| target "server" { | ||
| dockerfile = "targets/server.Dockerfile" | ||
| tags = compact([ | ||
| "${IMAGE_REPO}/server:${IMAGE_SHA_TAG}", | ||
| "${IMAGE_REPO}/server:${SAFE_IMAGE_BRANCH_TAG}", | ||
| TAG_LATEST ? "${IMAGE_REPO}/server:latest" : "", | ||
| ]) | ||
| platforms = ["linux/amd64", "linux/arm64"] | ||
| args = { | ||
| ALPINE_IMAGE = "${ALPINE_IMAGE}" | ||
| } | ||
| labels = { | ||
| "org.opencontainers.image.title" = "server" | ||
| "org.opencontainers.image.description" = "Temporal Server" | ||
| "org.opencontainers.image.url" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.source" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.licenses" = "MIT" | ||
| "org.opencontainers.image.version" = "${SERVER_VERSION}" | ||
| "org.opencontainers.image.revision" = "${TEMPORAL_SHA}" | ||
| "org.opencontainers.image.created" = timestamp() | ||
| "com.temporal.server.version" = "${SERVER_VERSION}" | ||
| } | ||
| } | ||
|
|
||
| target "legacy-server" { | ||
| dockerfile = "targets/legacy-server.Dockerfile" | ||
| tags = compact([ | ||
| "${IMAGE_REPO}/server:${IMAGE_SHA_TAG}", | ||
| "${IMAGE_REPO}/server:${SAFE_IMAGE_BRANCH_TAG}", | ||
| TAG_LATEST ? "${IMAGE_REPO}/server:latest" : "", | ||
| ]) | ||
| platforms = ["linux/amd64", "linux/arm64"] | ||
| args = { | ||
| ALPINE_IMAGE = "${ALPINE_IMAGE}" | ||
| TEMPORAL_VERSION = "${SERVER_VERSION}" | ||
| TEMPORAL_SHA = "${TEMPORAL_SHA}" | ||
| } | ||
| labels = { | ||
| "org.opencontainers.image.title" = "server" | ||
| "org.opencontainers.image.description" = "Temporal Server with tctl" | ||
| "org.opencontainers.image.url" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.source" = "https://github.com/temporalio/temporal" | ||
| "org.opencontainers.image.licenses" = "MIT" | ||
| "org.opencontainers.image.version" = "${SERVER_VERSION}" | ||
| "org.opencontainers.image.revision" = "${TEMPORAL_SHA}" | ||
| "org.opencontainers.image.created" = timestamp() | ||
| "com.temporal.server.version" = "${SERVER_VERSION}" | ||
| "com.temporal.cli.version" = "${CLI_VERSION}" | ||
| "com.temporal.tctl.version" = "${TCTL_VERSION}" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.