32 lines
776 B
Docker
32 lines
776 B
Docker
FROM node:20-slim AS base
|
|
|
|
# Install dependencies only when needed
|
|
FROM base AS deps
|
|
RUN corepack enable
|
|
|
|
|
|
|
|
FROM deps AS build
|
|
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}
|
|
WORKDIR /usr/src/app
|
|
COPY . .
|
|
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
|
|
|
|
|
|
FROM deps AS dev
|
|
WORKDIR /app
|
|
COPY --from=build /usr/src/app /app
|
|
CMD ["pnpm", "run", "dev"]
|
|
|
|
FROM deps AS next
|
|
WORKDIR /app
|
|
COPY --from=build /usr/src/app /app
|
|
CMD ["pnpm", "start"] |