# Two-stage build for the llink web SPA. APP_ENV is baked into the bundle
# at build time via vite's `define` (see vite.env.ts).
FROM node:22-alpine AS builder

WORKDIR /app
ARG APP_ENV=prod

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile

COPY . .
RUN APP_ENV=$APP_ENV yarn web:build:ci

FROM nginx:1.27-alpine
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/dist-web /usr/share/nginx/html
EXPOSE 80
