fp/d.migrations.dockerfile

21 lines
738 B
Plaintext
Raw Normal View History

2024-07-30 20:34:25 +00:00
FROM node:20-alpine AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@9.6.0 --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"]