FROM node:24-alpine AS build
ARG NEXUS_VERSION=dev
ARG NEXUS_GIT_SHA=unknown
ENV VITE_BUILD_VERSION=${NEXUS_VERSION}
ENV VITE_BUILD_SHA=${NEXUS_GIT_SHA}
ENV VITE_BROWSER_TELEMETRY_ENABLED=true
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile=false
COPY . .
RUN pnpm build

FROM nginx:1.27-alpine
ARG NEXUS_VERSION=dev
ARG NEXUS_GIT_SHA=unknown
LABEL org.opencontainers.image.title="Nexus Web" \
      org.opencontainers.image.source="https://git.noveria.net/bao/nexus" \
      org.opencontainers.image.version="${NEXUS_VERSION}" \
      org.opencontainers.image.revision="${NEXUS_GIT_SHA}"
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80

