Skip to content

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

chore: add back frontend build to docker (#7947)

Danny Xu73a243821c2e
diff --git a/.github/workflows/build-push-ci-image-depot.yml b/.github/workflows/build-push-ci-image-depot.yml
index d9cd682965..849d4c6d45 100644
--- a/.github/workflows/build-push-ci-image-depot.yml
+++ b/.github/workflows/build-push-ci-image-depot.yml
@@ -21,21 +21,6 @@ jobs:
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
echo "BUILD_USER=$(id -u -n)" >> $GITHUB_ENV
- - uses: pnpm/[email protected]
- with:
- version: 8.6.0
- - uses: actions/setup-node@v3
- with:
- node-version: "18"
- cache: pnpm
- cache-dependency-path: "frontend/pnpm-lock.yaml"
- - run: pnpm install --frozen-lockfile
- working-directory: frontend
- - name: Run pnpm release build
- run: |
- cp backend/plugin/advisor/config/* frontend/src/types
- cp backend/enterprise/api/plan.yaml frontend/src/types
- pnpm --dir ./frontend i && pnpm --dir ./frontend release
- name: Login to DockerHub
uses: docker/login-action@v2
with:
@@ -47,7 +32,7 @@ jobs:
uses: depot/build-push-action@v1
with:
context: .
- project: jv967c892k
+ project: ${{ secrets.DEPOT_PROJECT}}
token: ${{ secrets.DEPOT_TOKEN }}
file: scripts/Dockerfile
platforms: linux/amd64,linux/arm64
diff --git a/.github/workflows/build-push-release-image.yml b/.github/workflows/build-push-release-image.yml
index 2a7084ecca..14934a01cb 100644
--- a/.github/workflows/build-push-release-image.yml
+++ b/.github/workflows/build-push-release-image.yml
@@ -23,33 +23,18 @@ jobs:
echo "GIT_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
echo "BUILD_USER=$(id -u -n)" >> $GITHUB_ENV
- - uses: pnpm/[email protected]
- with:
- version: 8.6.0
- - uses: actions/setup-node@v3
- with:
- node-version: "18"
- cache: pnpm
- cache-dependency-path: "frontend/pnpm-lock.yaml"
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- - run: pnpm install --frozen-lockfile
- working-directory: frontend
- - name: Run pnpm release build
- run: |
- cp backend/plugin/advisor/config/* frontend/src/types
- cp backend/enterprise/api/plan.yaml frontend/src/types
- pnpm --dir ./frontend i && pnpm --dir ./frontend release
- uses: depot/setup-action@v1
- name: Build and push
id: bytebase_build
uses: depot/build-push-action@v1
with:
context: .
- project: jv967c892k
+ project: ${{ secrets.DEPOT_PROJECT}}
token: ${{ secrets.DEPOT_TOKEN }}
file: scripts/Dockerfile
platforms: linux/amd64,linux/arm64
@@ -67,7 +52,7 @@ jobs:
uses: depot/build-push-action@v1
with:
context: .
- project: jv967c892k
+ project: ${{ secrets.DEPOT_PROJECT}}
token: ${{ secrets.DEPOT_TOKEN }}
file: scripts/Dockerfile.bb
push: true
@@ -84,7 +69,7 @@ jobs:
uses: depot/build-push-action@v1
with:
context: .
- project: jv967c892k
+ project: ${{ secrets.DEPOT_PROJECT}}
token: ${{ secrets.DEPOT_TOKEN }}
file: scripts/Dockerfile.sql-service
push: true
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 01cdccea74..16cb1f9b23 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -5,6 +5,27 @@
# $ docker run --init --rm --name bytebase --publish 8080:8080 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase
+FROM node:18 as frontend
+
+ARG TARGETARCH
+ARG RELEASE="release"
+
+RUN npm i -g pnpm
+
+WORKDIR /frontend-build
+
+# Install build dependency (e.g. vite)
+COPY ./frontend/package.json ./frontend/pnpm-lock.yaml ./
+RUN pnpm install --frozen-lockfile
+
+COPY ./frontend/ .
+# Copy the SQL review config files to the frontend
+COPY ./backend/plugin/advisor/config/ ./src/types
+COPY ./backend/enterprise/api/plan.yaml ./src/types/
+
+# Build frontend
+RUN pnpm "${RELEASE}-docker"
+
FROM golang:1.21.0 as backend
ADD go.mod go.sum /
RUN go mod download
@@ -29,9 +50,6 @@ WORKDIR /backend-build
COPY . .
-RUN ls -al
-RUN ls -al ./backend/server
-
# -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 \
diff --git a/scripts/build_bytebase_docker.sh b/scripts/build_bytebase_docker.sh
index 60a87eddfa..bc69eceb30 100755
--- a/scripts/build_bytebase_docker.sh
+++ b/scripts/build_bytebase_docker.sh
@@ -12,19 +12,6 @@ cd "$(dirname "$0")/../"
echo "Start building Bytebase docker image ${VERSION}..."
-rm -r ./backend/server/dist
-
-echo "Start building Bytebase frontend"
-
-if command -v pnpm > /dev/null
-then
- pnpm --dir ./frontend i && pnpm --dir ./frontend release
-else
- npm --prefix ./frontend run release
-fi
-
-echo "Completed building Bytebase frontend."
-
docker build -f ./scripts/Dockerfile \
--build-arg VERSION=${VERSION} \
--build-arg GO_VERSION="$(go version)" \