FROM node:20-alpine AS build

WORKDIR /app

COPY package.json yarn.lock ./
COPY shared/package.json shared/
COPY mobile/package.json mobile/

RUN yarn install --frozen-lockfile

COPY shared/ shared/
COPY mobile/ mobile/

RUN yarn workspace @cloud-reader/shared build

# Expo export for web deployment
RUN yarn workspace @cloud-reader/mobile expo export --platform web

FROM nginx:alpine
COPY --from=build /app/mobile/dist /usr/share/nginx/html
EXPOSE 80