File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,21 @@ WORKDIR /app
44COPY package*.json ./
55RUN npm ci
66COPY . .
7+ # CRA inlines REACT_APP_* vars at build time (`npm run build`), not at container
8+ # runtime -- setting them in docker-compose.yml's `environment:` only affects the
9+ # already-built static bundle's process, which never reads them. They have to
10+ # come in as build args here, or the src/*.jsx fallbacks (127.0.0.1:8000 etc.)
11+ # are silently the only value that's ever actually compiled in.
12+ ARG REACT_APP_OMNIBIOAI_BASE_URL
13+ ARG REACT_APP_OMNIBIOAI_TOKEN
14+ ARG REACT_APP_JUPYTER_BASE
15+ ARG REACT_APP_JUPYTER_TOKEN
16+ ARG REACT_APP_USE_MOCK
17+ ENV REACT_APP_OMNIBIOAI_BASE_URL=$REACT_APP_OMNIBIOAI_BASE_URL \
18+ REACT_APP_OMNIBIOAI_TOKEN=$REACT_APP_OMNIBIOAI_TOKEN \
19+ REACT_APP_JUPYTER_BASE=$REACT_APP_JUPYTER_BASE \
20+ REACT_APP_JUPYTER_TOKEN=$REACT_APP_JUPYTER_TOKEN \
21+ REACT_APP_USE_MOCK=$REACT_APP_USE_MOCK
722RUN npm run build
823
924# ── Stage 2: nginx + node API server ──────────────────────────────────────────
Original file line number Diff line number Diff line change @@ -15,4 +15,17 @@ server {
1515 location / {
1616 try_files $uri $uri / /index .html;
1717 }
18+
19+ # Long-cache hashed build assets; index.html itself falls through to the
20+ # default (uncached) location above so deploys are picked up immediately.
21+ # Mirrors omnibioai-studio's docker/nginx-web.conf split -- without this,
22+ # neither index.html nor the hashed static/js|css/*.js|css files carried
23+ # any explicit Cache-Control at all, leaving browsers to fall back on
24+ # heuristic caching for both, including the ones that should be
25+ # immutable forever and the one that must never look stale.
26+ location ~ * \.(?:js|css|woff2?|ttf|svg|png|jpg|jpeg|gif|ico)$ {
27+ try_files $uri =404 ;
28+ expires 1y ;
29+ add_header Cache-Control "public, immutable" ;
30+ }
1831}
You can’t perform that action at this time.
0 commit comments