Skip to content

Commit 3936633

Browse files
committed
feat(beta): serve Admin SPA at /webapp, landing page at /
1 parent b84a9cf commit 3936633

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

Dockerfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ FROM build-deps AS ui-build
4949
ARG VITE_ENCRYPTION_SECRET=proxy-smart-default-encryption-key
5050
ENV VITE_ENCRYPTION_SECRET=${VITE_ENCRYPTION_SECRET}
5151

52+
# Base path for the UI (/ for mono, /webapp/ for split deployment)
53+
ARG VITE_BASE=/
54+
ENV VITE_BASE=${VITE_BASE}
55+
5256
# Copy UI source code
5357
COPY shared-ui/ ./shared-ui/
5458
COPY ui/ ./ui/
@@ -97,20 +101,24 @@ CMD ["bun", "run", "dist/index.js"]
97101
FROM nginx:alpine AS ui
98102
WORKDIR /usr/share/nginx/html
99103

100-
# Copy built UI
101-
COPY --from=ui-build /app/ui/dist .
104+
# Copy built UI into /webapp/ subdirectory
105+
COPY --from=ui-build /app/ui/dist /usr/share/nginx/html/webapp
102106

103-
# Copy custom nginx config for SPA routing
107+
# Copy custom nginx config for SPA routing under /webapp/
104108
COPY <<EOF /etc/nginx/conf.d/default.conf
105109
server {
106110
listen 80;
107111
server_name localhost;
108-
root /usr/share/nginx/html;
109-
index index.html;
110112

111-
# Handle client-side routing
112-
location / {
113-
try_files \$uri \$uri/ /index.html;
113+
# Serve the Admin SPA under /webapp/
114+
location /webapp/ {
115+
alias /usr/share/nginx/html/webapp/;
116+
try_files \$uri \$uri/ /webapp/index.html;
117+
}
118+
119+
# Redirect /webapp to /webapp/
120+
location = /webapp {
121+
return 301 /webapp/;
114122
}
115123

116124
# Cache static assets

docker-compose.beta.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ services:
8787
CORS_ORIGINS: https://beta.proxy-smart.com
8888
labels:
8989
caddy: beta.proxy-smart.com
90-
caddy.@backend.path: "/.well-known/* /health /status /auth/* /admin/* /monitoring/* /oauth/* /consent/* /fhir-servers/* /docs/* /mcp /mcp/* /proxy-smart-backend/* /apps /apps/ /apps/* /apps.json /webapp /webapp/ /webapp/* /swagger /swagger/* /openapi.json"
90+
caddy.@backend.path: "/ /.well-known/* /health /status /auth/* /admin/* /monitoring/* /oauth/* /consent/* /fhir-servers/* /docs/* /mcp /mcp/* /proxy-smart-backend/* /apps /apps/ /apps/* /apps.json /swagger /swagger/* /openapi.json"
9191
caddy.1_reverse_proxy: "@backend {{upstreams 8445}}"
9292
depends_on:
9393
- keycloak
@@ -102,13 +102,15 @@ services:
102102
target: ui
103103
args:
104104
VITE_ENCRYPTION_SECRET: ${VITE_ENCRYPTION_SECRET:-proxy-smart-beta-encryption-key}
105+
VITE_BASE: /webapp/
105106
container_name: proxy-smart-frontend-beta
106107
restart: unless-stopped
107108
environment:
108109
VITE_API_BASE_URL: https://beta.proxy-smart.com
109110
labels:
110111
caddy: beta.proxy-smart.com
111-
caddy.2_reverse_proxy: "{{upstreams 80}}"
112+
caddy.@webapp.path: "/webapp /webapp/*"
113+
caddy.2_reverse_proxy: "@webapp {{upstreams 80}}"
112114
depends_on:
113115
- backend
114116
networks:

0 commit comments

Comments
 (0)