Parameterize the previously hardcoded API_BASE so a staging build can point at
the staging API without forking the code:
- env.js.template + /docker-entrypoint.d/30-fleetnow-env.sh render ${API_BASE}
into /env.js on container start (envsubst ships with the nginx image)
- index.html loads /env.js and uses window.FLEETNOW_API_BASE, falling back to
the prod API (https://fleetapi.rahamafresh.com) when unset — so prod/main is
unchanged; staging sets API_BASE=https://fleetapi.fivetitude.com
- nginx: serve /env.js with no-store
Enables the fleetnow.fivetitude.com staging app (Coolify, staging branch).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
28 lines
1.3 KiB
Docker
28 lines
1.3 KiB
Docker
# FleetNow — static single-file SPA served by nginx.
|
|
# Coolify auto-detects this Dockerfile; set the app's port to 80 and attach
|
|
# the domain (fleetnow.rahamafresh.com) in the Coolify UI — Traefik + LE are
|
|
# wired automatically from there.
|
|
FROM nginx:1.27-alpine
|
|
|
|
# Drop the stock default site, add ours.
|
|
RUN rm -f /etc/nginx/conf.d/default.conf
|
|
COPY nginx.conf /etc/nginx/conf.d/fleetnow.conf
|
|
|
|
# The whole app is one self-contained file (inline CSS/JS; MapLibre from a CDN).
|
|
COPY index.html /usr/share/nginx/html/index.html
|
|
|
|
# Runtime API-base injection: the entrypoint renders ${API_BASE} -> /env.js at
|
|
# container start (envsubst ships with the nginx image). Set API_BASE per env;
|
|
# unset falls back to the prod API, so prod/main is unaffected.
|
|
COPY env.js.template /usr/share/nginx/html/env.js.template
|
|
COPY docker-entrypoint.d/30-fleetnow-env.sh /docker-entrypoint.d/30-fleetnow-env.sh
|
|
RUN chmod +x /docker-entrypoint.d/30-fleetnow-env.sh
|
|
|
|
# Static map-overlay data (toggleable layers: gas stations, etc.), served at /layers/.
|
|
COPY layers/ /usr/share/nginx/html/layers/
|
|
|
|
EXPOSE 80
|
|
|
|
# Coolify reads this; also handy for `docker ps` health.
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget -qO- http://localhost/healthz >/dev/null 2>&1 || exit 1
|