Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: remove cgo as it's already the default (#15548)
Danny Xu200e12033fc9
diff --git a/backend/bin/server/cmd/version.go b/backend/bin/server/cmd/version.goindex 6d631e4f2e..bb613444e7 100644--- a/backend/bin/server/cmd/version.go+++ b/backend/bin/server/cmd/version.go@@ -8,10 +8,7 @@ import (// These should be set via go build -ldflags -X 'xxxx'.var version = "development"-var goversion = "unknown"var gitcommit = "unknown"-var buildtime = "unknown"-var builduser = "unknown"func init() {rootCmd.AddCommand(versionCmd)@@ -22,9 +19,6 @@ var versionCmd = &cobra.Command{Short: "Print the version of Bytebase",Run: func(_ *cobra.Command, _ []string) {fmt.Printf("Bytebase version: %s\n", version)- fmt.Printf("Golang version: %s\n", goversion)fmt.Printf("Git commit hash: %s\n", gitcommit)- fmt.Printf("Built on: %s\n", buildtime)- fmt.Printf("Built by: %s\n", builduser)},}diff --git a/scripts/Dockerfile b/scripts/Dockerfileindex 47808fe0c6..63c7128a5f 100644--- a/scripts/Dockerfile+++ b/scripts/Dockerfile@@ -1,13 +1,4 @@-# DO NOT run docker build against this file directly. Instead using ./build_bytebase_docker.sh as that-# one sets the various ARG used in the Dockerfile--# After build--# $ docker run --init --rm --name bytebase --publish 8080:8080 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase--FROM node:22.12.0 as frontend--ARG RELEASE="release"+FROM node:22.14.0 as frontendRUN npm i -g pnpm@@ -26,14 +17,11 @@ ARG TARGETARCHARG VERSION="development"ARG GIT_COMMIT="unknown"-ARG RELEASE="release"--# Need gcc for CGO_ENABLED=1RUN if [ "$TARGETARCH" = "arm64" ]; then \apt-get install -y gcc-aarch64-linux-gnu; \- else \+ else \apt-get install -y gcc ;\- fi+ fiRUN apt-get update && apt-get install -y libkrb5-devWORKDIR /backend-build@@ -46,15 +34,11 @@ COPY --from=frontend /frontend-build/frontend/dist ./backend/server/distCOPY ./scripts/VERSION .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-# go-sqlite3 requires CGO_ENABLED-RUN if [ "$TARGETARCH" = "arm64" ]; then \- CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; \- fi && \- VERSION=`cat ./scripts/VERSION` && 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.gitcommit=${GIT_COMMIT}'" \- -o bytebase \- ./backend/bin/server/main.go+RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \+ VERSION=`cat ./scripts/VERSION` && 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.gitcommit=${GIT_COMMIT}'" \+ -o bytebase ./backend/bin/server/main.go# Use debian to decompress tar files.FROM debian:bookworm-slim as decompressordiff --git a/scripts/Dockerfile.aws b/scripts/Dockerfile.awsindex d9d2d3450a..f627453c43 100644--- a/scripts/Dockerfile.aws+++ b/scripts/Dockerfile.aws@@ -1,13 +1,4 @@-# DO NOT run docker build against this file directly. Instead using ./build_bytebase_docker.sh as that-# one sets the various ARG used in the Dockerfile--# After build--# $ docker run --init --rm --name bytebase --publish 8080:8080 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase--FROM node:22.12.0 as frontend--ARG RELEASE="release"+FROM node:22.14.0 as frontendRUN npm i -g pnpm@@ -27,14 +18,11 @@ ARG VERSION="development"ARG GIT_COMMIT="unknown"ARG PRODUCT_ID="prod-n4dmmye4e6hjo"-ARG RELEASE="release"--# Need gcc for CGO_ENABLED=1RUN if [ "$TARGETARCH" = "arm64" ]; then \apt-get install -y gcc-aarch64-linux-gnu; \- else \+ else \apt-get install -y gcc ;\- fi+ fiRUN apt-get update && apt-get install -y libkrb5-devWORKDIR /backend-build@@ -47,15 +35,12 @@ COPY --from=frontend /frontend-build/frontend/dist ./backend/server/distCOPY ./scripts/VERSION .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-# go-sqlite3 requires CGO_ENABLED-RUN if [ "$TARGETARCH" = "arm64" ]; then \- CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; \- fi && \- VERSION=`cat ./scripts/VERSION` && 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.gitcommit=${GIT_COMMIT}'" \- -o bytebase \- ./backend/bin/server/main.go+RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \+ VERSION=`cat ./scripts/VERSION` && 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.gitcommit=${GIT_COMMIT}'" \+ -o bytebase \+ ./backend/bin/server/main.go# Use debian to decompress tar files.FROM debian:bookworm-slim as decompressordiff --git a/scripts/Dockerfile.demo b/scripts/Dockerfile.demoindex 4f50b09ba8..32e356e36e 100644--- a/scripts/Dockerfile.demo+++ b/scripts/Dockerfile.demo@@ -1,7 +1,6 @@-FROM node:22.12.0 as frontend+FROM node:22.14.0 as frontendARG GIT_COMMIT="unknown"-ARG RELEASE="dev"RUN npm i -g pnpm@@ -17,9 +16,7 @@ ADD go.mod go.sum /RUN go mod downloadARG GIT_COMMIT="unknown"-ARG RELEASE="dev"-# Need gcc for CGO_ENABLED=1RUN apt-get install -y gccRUN apt-get update && apt-get install -y libkrb5-dev@@ -33,12 +30,11 @@ COPY --from=frontend /frontend-build/frontend/dist ./backend/server/distCOPY ./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 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.gitcommit=${GIT_COMMIT}'" \- -o bytebase \- ./backend/bin/server/main.go+RUN VERSION=`cat ./VERSION` && go build \+ --tags "dev,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.gitcommit=${GIT_COMMIT}'" \+ -o bytebase \+ ./backend/bin/server/main.go# Use debian to decompress tar files.FROM debian:bookworm-slim as decompressordiff --git a/scripts/Dockerfile.depot b/scripts/Dockerfile.depotindex 7f964763ef..41b871c967 100644--- a/scripts/Dockerfile.depot+++ b/scripts/Dockerfile.depot@@ -5,14 +5,11 @@ RUN go mod downloadARG VERSION="development"ARG GIT_COMMIT="unknown"-ARG RELEASE="release"--# Need gcc for CGO_ENABLED=1RUN if [ "$TARGETARCH" = "arm64" ]; then \apt-get install -y gcc-aarch64-linux-gnu; \- else \+ else \apt-get install -y gcc ;\- fi+ fiRUN apt-get update && apt-get install -y libkrb5-devWORKDIR /backend-build@@ -20,15 +17,11 @@ WORKDIR /backend-buildCOPY . .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information-# go-sqlite3 requires CGO_ENABLED-RUN if [ "$TARGETARCH" = "arm64" ]; then \- CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; \- fi && \- VERSION=`cat ./scripts/VERSION` && 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.gitcommit=${GIT_COMMIT}'" \- -o bytebase \- ./backend/bin/server/main.go+RUN if [ "$TARGETARCH" = "arm64" ]; then CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; fi && \+ VERSION=`cat ./scripts/VERSION` && 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.gitcommit=${GIT_COMMIT}'" \+ -o bytebase ./backend/bin/server/main.go# Use debian to decompress tar files.FROM debian:bookworm-slim as decompressordiff --git a/scripts/build_bytebase.sh b/scripts/build_bytebase.shindex 89a3944a41..3982bfd7d7 100755--- a/scripts/build_bytebase.sh+++ b/scripts/build_bytebase.sh@@ -48,23 +48,10 @@ echo "Completed building Bytebase frontend."echo ""echo "Step 2 - building Bytebase backend..."-flags="-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 rev-parse HEAD)'--X 'github.com/bytebase/bytebase/backend/bin/server/cmd.buildtime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")'--X 'github.com/bytebase/bytebase/backend/bin/server/cmd.builduser=$(id -u -n)'"--CGO_ENABLED=1 go build -p=8 --tags "release,embed_frontend" -ldflags "-w -s $flags" -o ${OUTPUT_BINARY} ./backend/bin/server/main.go--echo "Completed building Bytebase backend."--echo ""-echo "Step 3 - printing version..."--${OUTPUT_BINARY} version+go build -p=8 --tags "release,embed_frontend" -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 rev-parse HEAD)'" -o ${OUTPUT_BINARY} ./backend/bin/server/main.goecho ""-echo "${GREEN}Completed building Bytebase monolithic ${VERSION} at ${OUTPUT_BINARY}.${NC}"+echo "${GREEN}Completed building Bytebase ${VERSION}.${NC}"echo ""echo "Command to start Bytebase on port 8080"echo ""