fp/dockerfiles/migrations.dockerfile

21 lines
727 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
2024-08-27 07:11:24 +00:00
RUN corepack enable && corepack prepare --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"]