fp/next.Dockerfile

26 lines
506 B
Docker
Raw Normal View History

2024-02-26 22:00:23 +00:00
FROM node:20-slim AS base
2024-02-27 15:52:43 +00:00
# Install dependencies only when needed
FROM base AS deps
2024-02-26 22:00:23 +00:00
RUN corepack enable
2024-02-27 15:52:43 +00:00
FROM deps AS build
WORKDIR /usr/src/app
2024-02-26 22:00:23 +00:00
COPY . .
2024-02-27 15:52:43 +00:00
ENV NEXT_TELEMETRY_DISABLED 1
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store pnpm install
RUN pnpm run -r build
RUN pnpm deploy --filter=fp-next /app
2024-02-26 22:00:23 +00:00
2024-02-27 15:52:43 +00:00
FROM deps AS dev
2024-02-26 22:00:23 +00:00
WORKDIR /app
2024-02-27 15:52:43 +00:00
COPY --from=build /usr/src/app /app
2024-02-26 22:00:23 +00:00
CMD ["pnpm", "run", "dev"]
2024-02-27 15:52:43 +00:00
FROM deps AS next
2024-02-26 22:00:23 +00:00
WORKDIR /app
2024-02-27 15:52:43 +00:00
COPY --from=build /usr/src/app /app
CMD ["pnpm", "start"]