Skip to content

OpenStock is an open-source alternative to expensive market platforms. Track real-time prices, set personalized alerts, and explore detailed company insights — built openly, for everyone, forever free.

fix(docker): let self-hosters turn on realtime mode again

ravixalgorithmfd9a569550d6
diff --git a/Dockerfile b/Dockerfile
index 49bbc65..f79aac9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,6 +19,11 @@ COPY . .
# The build needs no secrets or database: pass every variable at runtime (FINNHUB_API_KEY, not NEXT_PUBLIC_*,
# which Next.js freezes at build time and would record in the image layers).
+# The one setting the browser needs at build time, and not a secret: "cached" (hourly quotes, the default) or
+# "realtime" (every 15 seconds, with price alerts). docker compose passes it from .env.
+ARG NEXT_PUBLIC_OPENSTOCK_DATA_MODE=cached
+ENV NEXT_PUBLIC_OPENSTOCK_DATA_MODE=$NEXT_PUBLIC_OPENSTOCK_DATA_MODE
+
# Build the Next.js application
RUN npm run build
# Or if using pnpm:
diff --git a/docker-compose.yml b/docker-compose.yml
index 445c140..1650c7b 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,6 +2,9 @@ services:
openstock:
build:
context: .
+ args:
+ # Fixed into the app at build time; set it in .env, then rebuild
+ NEXT_PUBLIC_OPENSTOCK_DATA_MODE: ${NEXT_PUBLIC_OPENSTOCK_DATA_MODE:-cached}
ports:
- "3000:3000"
env_file: