2026-04-15-2 dashboard convert to html without vite and react
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
FROM node:20-alpine
|
||||
FROM nginx:alpine
|
||||
|
||||
WORKDIR /app
|
||||
# Remove default nginx static assets
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
|
||||
# Install dependencies placeholder
|
||||
COPY apps/dashboard/package*.json ./
|
||||
RUN npm install
|
||||
# Copy static assets into nginx
|
||||
COPY apps/dashboard/index.html /usr/share/nginx/html/
|
||||
COPY apps/dashboard/js /usr/share/nginx/html/js/
|
||||
COPY apps/dashboard/css /usr/share/nginx/html/css/
|
||||
|
||||
# Copy source
|
||||
COPY apps/dashboard/ .
|
||||
# Fix networking issues by adding a simple redirect for spa if needed
|
||||
# But for hash-based routing, default index.html is enough.
|
||||
# We also need to handle the API proxy if we want to avoid CORS issues
|
||||
# However, the user's docker-compose has the API and Dashboard on different ports.
|
||||
# In a real production, we'd use Nginx to proxy /api to the backend.
|
||||
|
||||
# Build for production
|
||||
RUN npm run build
|
||||
COPY infrastructure/docker/dashboard/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# We use a simple static server or just serve from Vite for demo
|
||||
# For production, we can use nginx, but let's stick to dev/preview mode for now
|
||||
# per user request to see "what happens"
|
||||
CMD ["npm", "run", "preview", "--", "--host", "--port", "5173"]
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Proxy API requests to the api service in docker
|
||||
location /api/ {
|
||||
proxy_pass http://api:3200/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
# Proxy Martin Vector Tiles (if accessed via dashboard directly)
|
||||
location /tiles/ {
|
||||
proxy_pass http://martin:3000/;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user