Files
catalogue_frontend/Dockerfile
Suriyakumarvijayanayagam 0dd8427817 Point the build-arg docs at the real API domain, mcp.nearle.ai.in
The API deployed to mcp.nearle.ai.in rather than mcp.catalogue.nearle.ai.in.
This matters more here than on the backend: VITE_API_BASE_URL is inlined at
build time, so a bundle built from the old value calls a host that does not
exist and every request fails with nothing in the server logs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-13 13:29:34 +05:30

37 lines
993 B
Docker

# ---- Build stage ----
FROM node:20-alpine AS build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# Which origin the built app sends its API calls to.
#
# Vite inlines env vars at build time, so this MUST be a build arg - setting it
# on the running container has no effect, the value is already baked into the
# JS bundle.
#
# docker build --build-arg VITE_API_BASE_URL=https://mcp.nearle.ai.in .
#
# Left empty by default, which keeps requests relative and same-origin so the
# nginx /api/* proxy below serves them. Set it when the API is on its own
# domain - and add this app's origin to the backend's API_CORS_ORIGINS, or the
# browser will block the responses.
ARG VITE_API_BASE_URL=""
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
RUN npm run build
# ---- Serve stage ----
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=build /app/dist/ .
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 3000
CMD ["nginx", "-g", "daemon off;"]