21 lines
727 B
Docker
21 lines
727 B
Docker
FROM node:20-alpine AS base
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
WORKDIR /app
|
|
RUN corepack enable && corepack prepare --activate
|
|
|
|
FROM base AS build
|
|
COPY ./pnpm-workspace.yaml ./.npmrc .
|
|
COPY ./services/migrations/package.json ./services/migrations/pnpm-lock.yaml ./services/migrations/
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm fetch
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prefer-offline
|
|
COPY ./services/migrations/ ./services/migrations/
|
|
RUN pnpm --filter=@futureporn/migrations deploy --prod /prod/migrations
|
|
RUN ls -las /prod/migrations
|
|
|
|
FROM base AS migrations
|
|
ENV NODE_ENV=production
|
|
COPY --from=build /prod/migrations .
|
|
ENTRYPOINT ["pnpm", "start"]
|
|
|