a68292c7e9
Allows serving the UI under a subpath (e.g. /ui) instead of root.
- Vite config reads BASE_PATH env var, sets it as the asset base
and injects __BASE_PATH__ for runtime use
- React Router uses basename from __BASE_PATH__ for client-side routing
- Nginx config uses ${BASE_PATH} placeholder, replaced at build time
- Dockerfile accepts BASE_PATH build arg (default: /)
- Woodpecker docker pipeline passes BASE_PATH=/ui
26 lines
428 B
Docker
26 lines
428 B
Docker
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
ARG BASE_PATH=/
|
|
ENV BASE_PATH=${BASE_PATH}
|
|
RUN npm run build
|
|
|
|
FROM nginx:alpine
|
|
|
|
ARG BASE_PATH=/
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
RUN sed -i "s|\${BASE_PATH}|${BASE_PATH}|g" /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|