Skip to content

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

chore: fix and simplify dockerfile frontend build (#9607)

Danny Xu62f49ccc00a0
diff --git a/.github/workflows/test_link.yml b/.github/workflows/test_link.yml
index ef95f171b6..78a2027135 100644
--- a/.github/workflows/test_link.yml
+++ b/.github/workflows/test_link.yml
@@ -10,7 +10,7 @@ on:
jobs:
go-tests:
- runs-on: self-hosted
+ runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
diff --git a/scripts/Dockerfile b/scripts/Dockerfile
index 1ac1adace4..302ec00ddf 100644
--- a/scripts/Dockerfile
+++ b/scripts/Dockerfile
@@ -14,17 +14,10 @@ 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/
+COPY . .
-# Build frontend
-RUN pnpm "${RELEASE}-docker"
+RUN pnpm --dir frontend install --frozen-lockfile
+RUN pnpm --dir frontend "${RELEASE}-docker"
FROM golang:1.21.3 as backend
ADD go.mod go.sum /
@@ -51,7 +44,7 @@ WORKDIR /backend-build
COPY . .
# Copy frontend asset
-COPY --from=frontend /frontend-build/dist ./backend/server/dist
+COPY --from=frontend /frontend-build/frontend/dist ./backend/server/dist
COPY ./scripts/VERSION .
diff --git a/scripts/Dockerfile.depot b/scripts/Dockerfile.depot
index e8912ef370..b2a8e34814 100644
--- a/scripts/Dockerfile.depot
+++ b/scripts/Dockerfile.depot
@@ -1,10 +1,3 @@
-# DO NOT run docker build against this file directly. Instead using ./build_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 golang:1.21.3 as backend
ADD go.mod go.sum /
RUN go mod download
diff --git a/scripts/Dockerfile.render-demo b/scripts/Dockerfile.render-demo
index e2317d3f6d..3eb5462051 100644
--- a/scripts/Dockerfile.render-demo
+++ b/scripts/Dockerfile.render-demo
@@ -8,17 +8,10 @@ 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/
+COPY . .
-# Build frontend
-RUN pnpm "${RELEASE}-docker"
+RUN pnpm --dir frontend install --frozen-lockfile
+RUN pnpm --dir frontend "${RELEASE}-docker"
FROM golang:1.21.3 as backend
ADD go.mod go.sum /
@@ -41,7 +34,7 @@ WORKDIR /backend-build
COPY . .
# Copy frontend asset
-COPY --from=frontend /frontend-build/dist ./backend/server/dist
+COPY --from=frontend /frontend-build/frontend/dist ./backend/server/dist
COPY ./scripts/VERSION .
diff --git a/scripts/build_bytebase_docker.sh b/scripts/build_bytebase_docker.sh
index 8f8a11333e..3b205eeb85 100755
--- a/scripts/build_bytebase_docker.sh
+++ b/scripts/build_bytebase_docker.sh
@@ -10,22 +10,9 @@ set -e
cd "$(dirname "$0")/../"
. ./scripts/build_init.sh
-rm -rf ./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."
-
echo "Start building Bytebase docker image ${VERSION}..."
-docker build -f ./scripts/Dockerfile.depot \
+docker build -f ./scripts/Dockerfile \
--build-arg VERSION=${VERSION} \
--build-arg GO_VERSION="$(go version)" \
--build-arg GIT_COMMIT="$(git rev-parse HEAD)"\