Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: add git commit for docker ci images (#2701)

Yilong Lic314064327bc
diff --git a/.github/workflows/build-push-ci-image.yml b/.github/workflows/build-push-ci-image.yml
index a937b9fe2e..08491ce7ba 100644
--- a/.github/workflows/build-push-ci-image.yml
+++ b/.github/workflows/build-push-ci-image.yml
@@ -16,9 +16,11 @@ jobs:
matrix:
include:
- docker-image-tag: "dev-ci"
- docker-build-args: "RELEASE=dev"
+ docker-build-args-release: "RELEASE=dev"
+ docker-build-args-version-suffix: "VERSION_SUFFIX=-dev-ci"
- docker-image-tag: "release-ci"
- docker-build-args: "RELEASE=release"
+ docker-build-args-release: "RELEASE=release"
+ docker-build-args-version-suffix: "VERSION_SUFFIX=-release-ci"
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
@@ -34,6 +36,9 @@ jobs:
file: Dockerfile
push: true
tags: bytebase/bytebase:${{ matrix.docker-image-tag }}
- build-args: ${{ matrix.docker-build-args }}
+ build-args: |
+ ${{ matrix.docker-build-args-release }}
+ ${{ matrix.docker-build-args-version-suffix }}
+ GIT_COMMIT=${{ GITHUB_SHA }}
- name: Image digest
run: echo "Successfully pushed bytebase/bytebase:${{ matrix.docker-image-tag }} " ${{ steps.docker_build.outputs.digest }}
diff --git a/Dockerfile b/Dockerfile
index 91c9f221fa..53b85de458 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -27,6 +27,7 @@ RUN pnpm "${RELEASE}-docker"
FROM golang:1.19 as backend
ARG VERSION="development"
+ARG VERSION_SUFFIX=""
ARG GO_VERSION="1.19"
ARG GIT_COMMIT="unknown"
ARG BUILD_TIME="unknown"
@@ -48,7 +49,7 @@ COPY ./scripts/VERSION .
# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information
# go-sqlite3 requires CGO_ENABLED
-RUN VERSION=`cat ./VERSION` && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
+RUN VERSION=`cat ./VERSION`${VERSION_SUFFIX} && CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
--tags "${RELEASE},embed_frontend" \
-ldflags="-w -s -X 'github.com/bytebase/bytebase/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/bin/server/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/bin/server/cmd.builduser=${BUILD_USER}'" \
-o bytebase \