Skip to content

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

Revert "chore: get rid of CGO (#983)" (#991)

Danny Xu1e407d1cbaf0
diff --git a/Dockerfile b/Dockerfile
index a4378e82ff..4347d7e510 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -28,6 +28,9 @@ ARG GIT_COMMIT="unknown"
ARG BUILD_TIME="unknown"
ARG BUILD_USER="unknown"
+# Need gcc musl-dev for CGO_ENABLED=1
+RUN apk --no-cache add gcc musl-dev
+
WORKDIR /backend-build
COPY . .
@@ -36,7 +39,8 @@ COPY . .
COPY --from=frontend /frontend-build/dist ./server/dist
# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information
-RUN GOOS=linux GOARCH=amd64 go build \
+# go-sqlite3 requires CGO_ENABLED
+RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build \
--tags "release alpine" \
-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 \