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: aws sh (#12935)
Danny Xuc05727a55524
diff --git a/scripts/Dockerfile.aws b/scripts/Dockerfile.awsindex 540a45ba1a..7830f1e513 100644--- a/scripts/Dockerfile.aws+++ b/scripts/Dockerfile.aws@@ -7,7 +7,6 @@FROM node:20.15.1 as frontend-ARG TARGETARCHARG RELEASE="release"RUN npm i -g pnpm@@ -23,6 +22,7 @@ FROM golang:1.22.5 as backendADD go.mod go.sum /RUN go mod download+ARG TARGETARCHARG VERSION="development"ARG VERSION_SUFFIX=""ARG GO_VERSION="1.22.5"@@ -35,10 +35,10 @@ ARG RELEASE="release"# Need gcc for CGO_ENABLED=1RUN if [ "$TARGETARCH" = "arm64" ]; then \- apt-get install -y gcc-aarch64-linux-gnu; \- else \- apt-get install -y gcc ;\- fi+ apt-get install -y gcc-aarch64-linux-gnu; \+else \+ apt-get install -y gcc ;\+fiRUN apt-get update && apt-get install -y libkrb5-devWORKDIR /backend-build@@ -53,17 +53,35 @@ COPY ./scripts/VERSION .# -ldflags="-w -s" means omit DWARF symbol table and the symbol table and debug information# go-sqlite3 requires CGO_ENABLEDRUN if [ "$TARGETARCH" = "arm64" ]; then \- CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; \- fi && \+ CC=aarch64-linux-gnu-gcc && CC_FOR_TARGET=gcc-aarch64-linux-gnu; \+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}'" \-o bytebase \./backend/bin/server/main.go+# Use debian to decompress tar files.+FROM debian:bookworm-slim as decompressor++ARG TARGETARCH++RUN apt-get update && apt-get install -y xz-utils+COPY ./backend/resources /tmp/bytebase/resources/+# These paths must match the paths in backened/resources/utils/utils_dir.go.+# The real resource dir is decided by the backend at runtime. But we can only extract these at build time.+# we extract resources to a specific dir here and the backend will create symlinks at runtime.+RUN mkdir -p /var/opt/bytebase/resources/mongoutil-1.6.1-linux-${TARGETARCH}/+RUN tar -Jxf /tmp/bytebase/resources/mongoutil/mongoutil-1.6.1-linux-${TARGETARCH}.txz -C /var/opt/bytebase/resources/mongoutil-1.6.1-linux-${TARGETARCH}/+RUN mkdir -p /var/opt/bytebase/resources/mysqlutil-8.0.33-linux-${TARGETARCH}/+RUN tar -zxf /tmp/bytebase/resources/mysqlutil/mysqlutil-8.0.33-linux-${TARGETARCH}.tar.gz -C /var/opt/bytebase/resources/mysqlutil-8.0.33-linux-${TARGETARCH}/+RUN mkdir -p /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16+RUN tar -Jxf /tmp/bytebase/resources/postgres/postgres-linux-${TARGETARCH}.txz -C /var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16/+# Use debian because mysql requires glibc.FROM debian:bookworm-slim as monolithic+ARG TARGETARCHARG VERSION="development"ARG GIT_COMMIT="unknown"ARG BUILD_TIME="unknown"@@ -83,11 +101,11 @@ RUN mkdir -p /var/opt/bytebaseRUN mkdir -p /var/opt/bytebase/pgdata-demo# Our HEALTHCHECK instruction in dockerfile needs curl.# Install psmisc to use killall command in demo.sh used by render.com.-RUN apt-get update && apt-get install -y locales curl psmisc procps libncurses5+RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales curl psmisc procps libncurses5 krb5-user# Generate en_US.UTF-8 locale which is needed to start postgres server.# Fix the posgres server issue (invalid value for parameter "lc_messages": "en_US.UTF-8").RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen-ENV PATH="${PATH}:/var/opt/bytebase/resources/postgres-linux-amd64-16/bin:/var/opt/bytebase/resources/postgres-linux-arm64-16/bin"+ENV PATH="${PATH}:/var/opt/bytebase/resources/postgres-linux-${TARGETARCH}-16/bin"# Copy utility scripts, we have# - Demo script to launch Bytebase in readonly demo mode@@ -95,6 +113,7 @@ COPY ./scripts /usr/local/bin/COPY ./scripts/.psqlrc /root/.psqlrcCOPY --from=backend /backend-build/bytebase /usr/local/bin/COPY --from=backend /etc/ssl/certs /etc/ssl/certs+COPY --from=decompressor /var/opt/bytebase/resources /bytebase/resourcesENV OPENSSL_CONF /etc/ssl/ENV AWS_PRODUCT_ID=$PRODUCT_IDdiff --git a/scripts/build_bytebase_aws.sh b/scripts/build_bytebase_aws.shold mode 100644new mode 100755index dbfbd486dc..2c4affd1a1--- a/scripts/build_bytebase_aws.sh+++ b/scripts/build_bytebase_aws.sh@@ -13,7 +13,7 @@ cd "$(dirname "$0")/../"echo "Start building Bytebase docker image ${VERSION}..."docker build -f ./scripts/Dockerfile.aws \- --build-arg VERSION=${VERSION} \+ --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")" \