# --- Release image ---
FROM node:22-alpine AS release
RUN apk --no-cache add git
WORKDIR /home/node/app

RUN corepack enable

COPY ./dist/packages ./packages

COPY ./package.json ./

# Force node-modules linker (no .yarnrc.yml in build context)
RUN echo 'nodeLinker: node-modules' > .yarnrc.yml

RUN yarn install 

RUN mkdir -p dist && ln -sf ../packages dist/packages

COPY ./entrypoint.sh ./
RUN chmod +x entrypoint.sh

EXPOSE ${PORT:-3000}

ENTRYPOINT ["./entrypoint.sh"]
