c2dd1dbf84
Without this, Vite sees VITE_API_URL as undefined (not empty string) at build time. The ?? operator only replaces null/undefined, not a missing var, so better-auth receives undefined — which it treats as a relative path and prepends window.location.origin at build time, resulting in the UAT URL being baked in. Explicitly setting ARG VITE_API_URL= (empty string) in the Dockerfile makes Vite see it as defined with empty value, so the || fallback fires at runtime. Fixes GRO-1280.
27 lines
774 B
Docker
27 lines
774 B
Docker
FROM node:20-alpine AS base
|
|
RUN corepack enable && corepack prepare pnpm@9.15.4 --activate
|
|
WORKDIR /app
|
|
|
|
# Install deps
|
|
FROM base AS deps
|
|
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
|
COPY apps/web/package.json apps/web/
|
|
COPY packages/types/package.json packages/types/
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Build
|
|
FROM deps AS builder
|
|
ARG VITE_API_URL=
|
|
ENV VITE_API_URL=
|
|
COPY packages/types/ packages/types/
|
|
COPY apps/web/ apps/web/
|
|
RUN pnpm --filter @groombook/web build
|
|
|
|
# Serve with nginx
|
|
FROM nginx:alpine AS runner
|
|
COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=builder /app/apps/web/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:80/ || exit 1
|