Files
cameleer-server/ui/Dockerfile
hsiegeln 51abe45fba
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m9s
CI / docker (push) Successful in 1m4s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 37s
feat: add BASE_PATH env var for serving UI from a subpath
When BASE_PATH is set (e.g., /server/), the entrypoint script injects
a <base> tag and rewrites asset paths in index.html. React Router reads
the basename from the <base> tag. Vite builds with relative paths.
Default / for standalone mode (no changes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 21:04:28 +02:00

35 lines
1.1 KiB
Docker

FROM --platform=$BUILDPLATFORM node:22-alpine AS build
WORKDIR /app
ARG REGISTRY_TOKEN
COPY package.json package-lock.json .npmrc ./
RUN echo "//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${REGISTRY_TOKEN}" >> .npmrc && \
npm ci
COPY . .
# Upgrade design system to latest dev snapshot (after COPY to bust Docker cache)
RUN echo "//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${REGISTRY_TOKEN}" >> .npmrc && \
npm install @cameleer/design-system@dev && \
rm -f .npmrc
ARG VITE_ENV_NAME=PRODUCTION
ENV VITE_ENV_NAME=$VITE_ENV_NAME
RUN npm run build
FROM nginx:1.27-alpine
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/templates/default.conf.template
COPY docker-entrypoint.sh /cameleer-entrypoint.sh
RUN chmod +x /cameleer-entrypoint.sh
# Default API URL — override via K8s env or docker run -e
ENV CAMELEER_API_URL=http://cameleer3-server:8081
# Base path for serving the SPA from a subpath (e.g., /server/). Default: /
ENV BASE_PATH=/
ENTRYPOINT ["/cameleer-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
EXPOSE 80