FROM node:25-alpine AS builder

WORKDIR /app

COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/ ./.yarn/
COPY panel/package.json ./panel/package.json
COPY api/package.json ./api/package.json
COPY common/package.json ./common/package.json

RUN yarn

COPY . .

RUN cd /app/common && yarn build
RUN cd /app/panel && yarn build

FROM nginx:1.29.3-alpine

COPY --from=builder /app/panel/dist /usr/share/nginx/html
