feat: Add APP_NAME env support for branding and deployment

- Make app name configurable via APP_NAME env variable - Update UI,
HTML, Docker, scripts, and k8s to use APP_NAME - Add process-html.sh for
template substitution - Document APP_NAME usage in
docs/APP_NAME_CONFIGURATION.md - Update Dockerfile, compose, and scripts
for dynamic naming - Add index.html.template for environment-based
branding
This commit is contained in:
William Valentin
2025-09-07 12:21:44 -07:00
parent 46d737ed37
commit 585c526a65
13 changed files with 352 additions and 51 deletions

View File

@@ -3,7 +3,7 @@
FROM oven/bun:alpine AS builder
# Install system dependencies for native modules
RUN apk add --no-cache python3 make g++
RUN apk add --no-cache python3 make g++ gettext
# Create non-root user for security
RUN addgroup -g 1001 -S nodeuser && adduser -S nodeuser -u 1001 -G nodeuser
@@ -24,6 +24,9 @@ RUN bun install --frozen-lockfile
COPY --chown=nodeuser:nodeuser . ./
# Build arguments for environment configuration
# Application Name
ARG APP_NAME=RxMinder
# CouchDB Configuration
ARG VITE_COUCHDB_URL=http://localhost:5984
ARG VITE_COUCHDB_USER=admin
@@ -41,6 +44,7 @@ ARG NODE_ENV=production
# Set environment variables for build process
# These are embedded into the static build at compile time
ENV VITE_APP_NAME=$APP_NAME
ENV VITE_COUCHDB_URL=$VITE_COUCHDB_URL
ENV VITE_COUCHDB_USER=$VITE_COUCHDB_USER
ENV VITE_COUCHDB_PASSWORD=$VITE_COUCHDB_PASSWORD
@@ -49,6 +53,9 @@ ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
ENV VITE_GITHUB_CLIENT_ID=$VITE_GITHUB_CLIENT_ID
ENV NODE_ENV=$NODE_ENV
# Process HTML template with APP_NAME
RUN envsubst '$APP_NAME' < index.html.template > index.html || cp index.html.template index.html
# Build the application
RUN bun run build
@@ -66,13 +73,13 @@ COPY --from=builder /app/docker/nginx.conf /etc/nginx/conf.d/default.conf
# Set proper permissions for nginx
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
chown -R nginx:nginx /var/cache/nginx && \
chown -R nginx:nginx /var/log/nginx && \
chown -R nginx:nginx /etc/nginx/conf.d
# Add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost/ || exit 1
CMD curl -f http://localhost/ || exit 1
# Expose port 80
EXPOSE 80

View File

@@ -5,6 +5,8 @@ services:
context: ..
dockerfile: docker/Dockerfile
args:
# Application Configuration
- APP_NAME=${APP_NAME:-RxMinder}
# CouchDB Configuration
- VITE_COUCHDB_URL=${VITE_COUCHDB_URL:-http://couchdb:5984}
- VITE_COUCHDB_USER=${VITE_COUCHDB_USER:-admin}
@@ -36,6 +38,7 @@ services:
labels:
- 'monitoring=true'
- 'service=frontend'
- 'app=${APP_NAME:-meds}'
# CouchDB service
couchdb:
@@ -56,6 +59,7 @@ services:
labels:
- 'monitoring=true'
- 'service=couchdb'
- 'app=${APP_NAME:-meds}'
# Redis service (commented out as per requirements)
# redis: