fp/dockerfiles/migrations-schema.dockerfile

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