fp/d.bot.dockerfile

41 lines
981 B
Docker

FROM node:20.15 as base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@9.5.0 --activate
ENTRYPOINT ["pnpm"]
FROM base AS install
COPY pnpm-lock.yaml .npmrc package.json .
COPY ./packages/bot/ ./packages/bot/
COPY ./packages/types/ ./packages/types/
COPY ./packages/storage/ ./packages/storage/
COPY ./packages/scout/ ./packages/scout/
COPY ./packages/image/ ./packages/image/
COPY ./packages/utils/ ./packages/utils/
# RUN ls -lash .
# RUN ls -lash ./packages/
# RUN ls -lash ./packages/bot/
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --recursive --frozen-lockfile --prefer-offline
# RUN ls -lash .
# RUN ls -la ./packages
FROM install AS build
RUN pnpm -r build
RUN pnpm deploy --filter=bot /prod/bot-dev
RUN pnpm deploy --filter=bot --prod /prod/bot
FROM base AS dev
COPY --from=build /prod/bot-dev .
CMD ["run", "dev"]
FROM base AS bot
COPY --from=build /prod/bot .
CMD ["run", "start"]