# Build context is the repository root.
FROM node:24-alpine AS build
WORKDIR /src
COPY . .
RUN corepack pnpm install --frozen-lockfile \
 && corepack pnpm --filter @homepage/backend --filter @homepage/frontend build

FROM node:24-alpine
COPY --from=build /src/apps/backend/dist/backend.js /app/backend.js
COPY --from=build /src/apps/frontend/dist /app/public
USER 10002:10002
EXPOSE 8080
CMD ["node", "/app/backend.js"]
