Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

build: let a packaged build say which build it is

Boris 'B' Kurktchiev9d60cad39838
diff --git a/frontend/vite.config.js b/frontend/vite.config.js
index c98c7e4be..8da9c724a 100644
--- a/frontend/vite.config.js
+++ b/frontend/vite.config.js
@@ -49,10 +49,17 @@ const swStamp = {
// The version people are asked for in #install-help and on every bug report. Read from
// package.json so it cannot drift from the release it was built in, and inlined at build
// time so no runtime fetch is involved.
+//
+// APP_BUILD, when the build sets it, is appended as "1.3.8+<build>". A packaged build carries a
+// version its package.json cannot know — every image built between two releases reports the same
+// number, so the one question a bug report turns on, "which build were you running?", had no
+// answer from inside the app. Unset (the ordinary case, and every upstream build) it changes
+// nothing: the string is exactly package.json's version.
const pkgVersion = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')).version
+const appVersion = process.env.APP_BUILD ? `${pkgVersion}+${process.env.APP_BUILD}` : pkgVersion
export default defineConfig({
- define: { __APP_VERSION__: JSON.stringify(pkgVersion) },
+ define: { __APP_VERSION__: JSON.stringify(appVersion) },
plugins: [react(), umami, swStamp],
base: './',
server: {
diff --git a/web/Dockerfile b/web/Dockerfile
index db9c761e9..394057b8d 100644
--- a/web/Dockerfile
+++ b/web/Dockerfile
@@ -20,7 +20,11 @@ COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci --ignore-scripts
COPY api/coach/core/ /app/api/coach/core/
COPY frontend/ ./
-RUN npm run build
+# Which build this is, shown in the app as "1.3.8+<build>" next to the version. Without it every
+# image built between two releases calls itself the same thing, and "which build are you running?"
+# cannot be answered from the phone. Unset, the app reports package.json's version as before.
+ARG APP_BUILD=""
+RUN APP_BUILD="$APP_BUILD" npm run build
FROM nginx:alpine
# Same reason as in api/Dockerfile: alpine fixes land faster than the nginx image is rebuilt.