32 lines
736 B
Docker
32 lines
736 B
Docker
FROM node:20 AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
WORKDIR /app
|
|
RUN corepack enable && corepack prepare --activate
|
|
ENTRYPOINT ["pnpm"]
|
|
|
|
FROM base AS install
|
|
COPY pnpm-lock.yaml .npmrc package.json .
|
|
COPY ./services/bot/ ./services/bot/
|
|
COPY ./packages/types/ ./packages/types/
|
|
COPY ./packages/utils/ ./packages/utils/
|
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm fetch
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --recursive --frozen-lockfile --prefer-offline
|
|
|
|
|
|
FROM install AS build
|
|
RUN pnpm -r build
|
|
RUN pnpm deploy --filter=bot --prod /prod/bot
|
|
|
|
|
|
FROM install AS dev
|
|
WORKDIR /app/services/bot
|
|
CMD ["run", "dev"]
|
|
|
|
|
|
FROM base AS bot
|
|
COPY --from=build /prod/bot .
|
|
CMD ["run", "start"]
|
|
|