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
|
2024-02-27 18:49:43 +00:00
|
|
|
ARG NEXT_PUBLIC_SITE_URL=foo
|
|
|
|
ARG NEXT_PUBLIC_STRAPI_URL=foo
|
|
|
|
ARG NEXT_PUBLIC_UPPY_COMPANION_URL=foo
|
|
|
|
ENV NEXT_PUBLIC_SITE_URL ${NEXT_PUBLIC_SITE_URL}
|
|
|
|
ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL}
|
|
|
|
ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL}
|
2024-02-27 15:52:43 +00:00
|
|
|
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"]
|