Skip to content

Automate browser based workflows with AI

fix: prevent settings page crash for self-hosted Docker builds (#5163)

Celal Zamanoğlu56275c862cf8
diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml
index d60a978c1..351c6e4fe 100644
--- a/.github/workflows/build-docker-image.yml
+++ b/.github/workflows/build-docker-image.yml
@@ -69,6 +69,8 @@ jobs:
with:
context: .
file: Dockerfile.ui
+ build-args: |
+ APP_VERSION=${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: |
diff --git a/Dockerfile.ui b/Dockerfile.ui
index 228bb1b86..f4d014cf1 100644
--- a/Dockerfile.ui
+++ b/Dockerfile.ui
@@ -14,6 +14,11 @@ ENV VITE_WSS_BASE_URL=__VITE_WSS_BASE_URL_PLACEHOLDER__
ENV VITE_ARTIFACT_API_BASE_URL=__VITE_ARTIFACT_API_BASE_URL_PLACEHOLDER__
ENV VITE_SKYVERN_API_KEY=__SKYVERN_API_KEY_PLACEHOLDER__
+# APP_VERSION is baked into the JS bundle at build time via Vite's define.
+# Pass --build-arg APP_VERSION=$(git rev-parse HEAD) when building the image.
+ARG APP_VERSION=development
+ENV APP_VERSION=$APP_VERSION
+
# Build at image time
RUN npm run build
diff --git a/skyvern-frontend/vite.config.ts b/skyvern-frontend/vite.config.ts
index 030e6b9cd..e03b29418 100644
--- a/skyvern-frontend/vite.config.ts
+++ b/skyvern-frontend/vite.config.ts
@@ -1,3 +1,4 @@
+import { execSync } from "child_process";
import path from "path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
@@ -16,4 +17,16 @@ export default defineConfig({
"@": path.resolve(__dirname, "./src"),
},
},
+ define: {
+ __APP_VERSION__: JSON.stringify(
+ process.env.APP_VERSION ||
+ (() => {
+ try {
+ return execSync("git rev-parse HEAD").toString().trim();
+ } catch {
+ return "development";
+ }
+ })(),
+ ),
+ },
});