Skip to content

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

chore: simplify build flag (#15517)

Danny Xuc03c5a412c2b
diff --git a/frontend/package.json b/frontend/package.json
index af7dbed808..7b377e12a3 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -5,9 +5,9 @@
"copy:monaco-workers": "sh ./scripts/copy_monaco_workers.sh",
"copy:config-files": "sh ./scripts/copy_config_files.sh",
"copy:all": "npm run copy:monaco-workers && npm run copy:config-files",
- "dev": "export BB_GIT_COMMIT_ID_FE=`git rev-parse HEAD` && export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite --mode dev-local",
+ "dev": "export GIT_COMMIT=`git rev-parse HEAD` && export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite --mode dev-local",
"release": "export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite build --mode release --outDir=../backend/server/dist --emptyOutDir",
- "dev-embed": "export BB_GIT_COMMIT_ID_FE=`git rev-parse HEAD` && export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite build --mode dev --outDir=../backend/server/dist --emptyOutDir",
+ "dev-embed": "export GIT_COMMIT=`git rev-parse HEAD` && export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite build --mode dev --outDir=../backend/server/dist --emptyOutDir",
"release-docker": "export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite build --mode release",
"release-aws": "export NODE_OPTIONS=--max_old_space_size=8000 && npm run copy:all && vite build --mode release-aws",
"lint": "eslint --cache src",
diff --git a/frontend/src/components/misc/Version.vue b/frontend/src/components/misc/Version.vue
index ea219b527e..4d1ad8472c 100644
--- a/frontend/src/components/misc/Version.vue
+++ b/frontend/src/components/misc/Version.vue
@@ -63,10 +63,6 @@
</template>
<script lang="ts" setup>
-import { Volume2Icon } from "lucide-vue-next";
-import { NTooltip, type TooltipProps } from "naive-ui";
-import { storeToRefs } from "pinia";
-import { computed, reactive } from "vue";
import {
useActuatorV1Store,
useAppFeature,
@@ -74,6 +70,10 @@ import {
} from "@/store";
import { PlanType } from "@/types/proto/v1/subscription_service";
import { autoSubscriptionRoute, hasWorkspacePermissionV2 } from "@/utils";
+import { Volume2Icon } from "lucide-vue-next";
+import { NTooltip, type TooltipProps } from "naive-ui";
+import { storeToRefs } from "pinia";
+import { computed, reactive } from "vue";
import ReleaseRemindModal from "../ReleaseRemindModal.vue";
import TrialModal from "../TrialModal.vue";
@@ -142,7 +142,7 @@ const gitCommitBE = computed(() => {
return `${actuatorStore.gitCommit.substring(0, 7)}`;
});
const gitCommitFE = computed(() => {
- const commitHash = import.meta.env.BB_GIT_COMMIT_ID_FE as string | undefined;
+ const commitHash = import.meta.env.GIT_COMMIT as string | undefined;
return (commitHash ?? "unknown").substring(0, 7);
});
</script>
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 21d643b5c2..521f1a2393 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -25,10 +25,7 @@ RUN go mod download
ARG TARGETARCH
ARG VERSION="development"
ARG VERSION_SUFFIX=""
-ARG GO_VERSION="1.24.0"
ARG GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
ARG RELEASE="release"
@@ -56,7 +53,7 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
fi && \
VERSION=`cat ./scripts/VERSION`${VERSION_SUFFIX} && CGO_ENABLED=1 GOOS=linux GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \
--tags "${RELEASE},embed_frontend,docker" \
- -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=${BUILD_USER}'" \
+ -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase \
./backend/bin/server/main.go
@@ -81,14 +78,10 @@ FROM debian:bookworm-slim as monolithic
ARG TARGETARCH
ARG VERSION="development"
ARG GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.version=${VERSION}
LABEL org.opencontainers.image.revision=${GIT_COMMIT}
-LABEL org.opencontainers.image.created=${BUILD_TIME}
-LABEL org.opencontainers.image.authors=${BUILD_USER}
# Create user "bytebase" for running Postgres database and server.
RUN addgroup --gid 113 --system bytebase && adduser --uid 113 --system bytebase && adduser bytebase bytebase
diff --git a/scripts/Dockerfile.aws b/scripts/Dockerfile.aws
index 92838037b5..8f849f2144 100644
--- a/scripts/Dockerfile.aws
+++ b/scripts/Dockerfile.aws
@@ -25,10 +25,7 @@ RUN go mod download
ARG TARGETARCH
ARG VERSION="development"
ARG VERSION_SUFFIX=""
-ARG GO_VERSION="1.24.0"
ARG GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
ARG PRODUCT_ID="prod-n4dmmye4e6hjo"
ARG RELEASE="release"
@@ -57,7 +54,7 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
fi && \
VERSION=`cat ./scripts/VERSION`${VERSION_SUFFIX} && CGO_ENABLED=1 GOOS=linux GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \
--tags "${RELEASE},embed_frontend,aws" \
- -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=${BUILD_USER}'" \
+ -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase \
./backend/bin/server/main.go
@@ -82,14 +79,10 @@ FROM debian:bookworm-slim as monolithic
ARG TARGETARCH
ARG VERSION="development"
ARG GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.version=${VERSION}
LABEL org.opencontainers.image.revision=${GIT_COMMIT}
-LABEL org.opencontainers.image.created=${BUILD_TIME}
-LABEL org.opencontainers.image.authors=${BUILD_USER}
# Create user "bytebase" for running Postgres database and server.
RUN addgroup --gid 113 --system bytebase && adduser --uid 113 --system bytebase && adduser bytebase bytebase
diff --git a/scripts/Dockerfile.render-demo b/scripts/Dockerfile.demo
similarity index 77%
rename from scripts/Dockerfile.render-demo
rename to scripts/Dockerfile.demo
index 3eaae0a84c..b198fc35e0 100644
--- a/scripts/Dockerfile.render-demo
+++ b/scripts/Dockerfile.demo
@@ -1,10 +1,6 @@
-# This script is for PR preview and demo.bytebase.com on Render ONLY.
-
FROM node:22.12.0 as frontend
-# RENDER_GIT_COMMIT is a render.com provided env var during build.
-# https://render.com/docs/environment-variables
-ARG RENDER_GIT_COMMIT="unknown"
+ARG GIT_COMMIT="unknown"
ARG RELEASE="dev"
RUN npm i -g pnpm
@@ -13,19 +9,14 @@ WORKDIR /frontend-build
COPY . .
-ENV BB_GIT_COMMIT_ID_FE="${RENDER_GIT_COMMIT}"
+ENV GIT_COMMIT="${GIT_COMMIT}"
RUN cd frontend && pnpm install --frozen-lockfile && pnpm release-docker
FROM golang:1.24.0 as backend
ADD go.mod go.sum /
RUN go mod download
-ARG GO_VERSION="1.24.0"
-# RENDER_GIT_COMMIT is a render.com provided env var during build.
-# https://render.com/docs/environment-variables
-ARG RENDER_GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
+ARG GIT_COMMIT="unknown"
ARG RELEASE="dev"
# Need gcc for CGO_ENABLED=1
@@ -45,7 +36,7 @@ COPY ./scripts/VERSION .
# go-sqlite3 requires CGO_ENABLED
RUN VERSION=`cat ./VERSION` && CGO_ENABLED=1 go build \
--tags "${RELEASE},embed_frontend,minidemo,docker" \
- -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${RENDER_GIT_COMMIT}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=${BUILD_USER}'" \
+ -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase \
./backend/bin/server/main.go
@@ -68,15 +59,11 @@ RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -
FROM debian:bookworm-slim as monolithic
ARG VERSION="development"
-ARG RENDER_GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
+ARG GIT_COMMIT="unknown"
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.version=${VERSION}
-LABEL org.opencontainers.image.revision=${RENDER_GIT_COMMIT}
-LABEL org.opencontainers.image.created=${BUILD_TIME}
-LABEL org.opencontainers.image.authors=${BUILD_USER}
+LABEL org.opencontainers.image.revision=${GIT_COMMIT}
# Create user "bytebase" for running Postgres database and server.
RUN addgroup --gid 113 --system bytebase && adduser --uid 113 --system bytebase && adduser bytebase bytebase
diff --git a/scripts/Dockerfile.depot b/scripts/Dockerfile.depot
index 07d28885bd..733c1df238 100644
--- a/scripts/Dockerfile.depot
+++ b/scripts/Dockerfile.depot
@@ -4,10 +4,7 @@ RUN go mod download
ARG VERSION="development"
ARG VERSION_SUFFIX=""
-ARG GO_VERSION="1.24.0"
ARG GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
ARG RELEASE="release"
@@ -30,7 +27,7 @@ RUN if [ "$TARGETARCH" = "arm64" ]; then \
fi && \
VERSION=`cat ./scripts/VERSION`${VERSION_SUFFIX} && CGO_ENABLED=1 GOOS=linux GOARCH=$TARGETARCH CC=$CC CC_FOR_TARGET=$CC_FOR_TARGET go build \
--tags "${RELEASE},embed_frontend,docker" \
- -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.goversion=${GO_VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime=${BUILD_TIME}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=${BUILD_USER}'" \
+ -ldflags="-w -s -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.version=${VERSION}' -X 'github.com/bytebase/bytebase/backend/bin/server/cmd.gitcommit=${GIT_COMMIT}'" \
-o bytebase \
./backend/bin/server/main.go
@@ -56,14 +53,10 @@ FROM debian:bookworm-slim as monolithic
ARG TARGETARCH
ARG VERSION="development"
ARG GIT_COMMIT="unknown"
-ARG BUILD_TIME="unknown"
-ARG BUILD_USER="unknown"
# See https://github.com/opencontainers/image-spec/blob/master/annotations.md
LABEL org.opencontainers.image.version=${VERSION}
LABEL org.opencontainers.image.revision=${GIT_COMMIT}
-LABEL org.opencontainers.image.created=${BUILD_TIME}
-LABEL org.opencontainers.image.authors=${BUILD_USER}
# Create user "bytebase" for running Postgres database and server.
RUN addgroup --gid 113 --system bytebase && adduser --uid 113 --system bytebase && adduser bytebase bytebase
diff --git a/scripts/build_bytebase.sh b/scripts/build_bytebase.sh
index 63ceacd3a3..89a3944a41 100755
--- a/scripts/build_bytebase.sh
+++ b/scripts/build_bytebase.sh
@@ -40,7 +40,7 @@ echo "Step 1 - building Bytebase frontend..."
rm -rf ./backend/server/dist
-export BB_GIT_COMMIT_ID_FE=$(git rev-parse HEAD)
+export GIT_COMMIT=$(git rev-parse HEAD)
pnpm --dir ./frontend i && pnpm --dir ./frontend release
echo "Completed building Bytebase frontend."
diff --git a/scripts/build_bytebase_aws.sh b/scripts/build_bytebase_aws.sh
index 2c4affd1a1..9524d78886 100755
--- a/scripts/build_bytebase_aws.sh
+++ b/scripts/build_bytebase_aws.sh
@@ -14,10 +14,7 @@ echo "Start building Bytebase docker image ${VERSION}..."
docker build -f ./scripts/Dockerfile.aws \
--build-arg VERSION="${VERSION}" \
- --build-arg GO_VERSION="$(go version)" \
--build-arg GIT_COMMIT="$(git rev-parse HEAD)" \
- --build-arg BUILD_TIME="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
- --build-arg BUILD_USER="$(id -u -n)" \
-t bytebase/bytebase .
echo "${GREEN}Completed building Bytebase docker image ${VERSION}.${NC}"
diff --git a/scripts/build_bytebase_docker.sh b/scripts/build_bytebase_docker.sh
index fa304a8766..1c0df91513 100755
--- a/scripts/build_bytebase_docker.sh
+++ b/scripts/build_bytebase_docker.sh
@@ -14,10 +14,7 @@ echo "Start building Bytebase docker image ${VERSION}..."
docker build -f ./scripts/Dockerfile \
--build-arg VERSION="${VERSION}" \
- --build-arg GO_VERSION="$(go version)" \
--build-arg GIT_COMMIT="$(git rev-parse HEAD)"\
- --build-arg BUILD_TIME="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
- --build-arg BUILD_USER="$(id -u -n)" \
-t bytebase/bytebase .
echo "${GREEN}Completed building Bytebase docker image ${VERSION}.${NC}"