fp/dockerfiles/migrations-data.dockerfile

21 lines
788 B
Docker

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-data/package.json ./services/migrations-data/pnpm-lock.yaml ./services/migrations-data/
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-data/ ./services/migrations-data/
RUN pnpm --filter=@futureporn/migrations-data deploy --prod /prod/migrations-data
RUN ls -las /prod/migrations-data
FROM base AS migrations-data
ENV NODE_ENV=production
COPY --from=build /prod/migrations-data .
ENTRYPOINT ["pnpm", "start"]