fp/dockerfiles/migrations.dockerfile

21 lines
738 B
Plaintext
Raw Permalink 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
2024-08-31 10:42:28 +00:00
RUN corepack enable && corepack prepare pnpm@9.6.0 --activate
2024-07-30 20:34:25 +00:00
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"]