2024-06-14 20:35:28 +00:00
|
|
|
# Build stage
|
2024-06-20 08:37:21 +00:00
|
|
|
FROM node:20-slim as base
|
2024-06-05 20:41:46 +00:00
|
|
|
|
2024-06-20 08:37:21 +00:00
|
|
|
WORKDIR /base
|
2024-06-14 20:35:28 +00:00
|
|
|
|
2024-06-20 08:37:21 +00:00
|
|
|
|
2024-06-23 08:32:21 +00:00
|
|
|
# Local Development
|
2024-06-20 08:37:21 +00:00
|
|
|
FROM base AS dev
|
|
|
|
ENTRYPOINT []
|
|
|
|
CMD ["pnpm", "dev:next"]
|
|
|
|
|
|
|
|
|
2024-06-23 13:01:05 +00:00
|
|
|
# Production: build
|
2024-06-20 08:37:21 +00:00
|
|
|
FROM base AS builder
|
2024-06-23 08:32:21 +00:00
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
RUN corepack enable
|
2024-06-23 08:39:59 +00:00
|
|
|
|
2024-06-23 08:32:21 +00:00
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
|
|
|
|
COPY . .
|
2024-06-20 08:37:21 +00:00
|
|
|
ENV NODE_ENV=production
|
2024-06-23 08:42:27 +00:00
|
|
|
RUN pnpm generate:types
|
2024-06-05 20:31:53 +00:00
|
|
|
RUN pnpm build
|
2024-06-05 20:25:53 +00:00
|
|
|
|
2024-06-20 08:37:21 +00:00
|
|
|
# Production: copy build artifacts
|
2024-06-14 20:35:28 +00:00
|
|
|
FROM node:20-slim as runner
|
2024-06-20 08:37:21 +00:00
|
|
|
WORKDIR /prod
|
2024-06-06 06:05:16 +00:00
|
|
|
|
2024-06-14 20:35:28 +00:00
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
2024-06-06 06:19:41 +00:00
|
|
|
RUN corepack enable
|
2024-06-05 20:25:53 +00:00
|
|
|
|
2024-06-20 08:37:21 +00:00
|
|
|
COPY --from=builder /base/package.json ./
|
|
|
|
COPY --from=builder /base/.next/standalone ./.next/standalone/
|
|
|
|
COPY --from=builder /base/.next/static ./.next/standalone/.next/static
|
|
|
|
COPY --from=builder /base/public ./.next/standalone/public
|
|
|
|
COPY --from=builder /base/next.config.mjs ./
|
2024-06-06 06:05:16 +00:00
|
|
|
|
2024-06-20 08:37:21 +00:00
|
|
|
# Production: serve the website
|
|
|
|
FROM runner as prod
|
2024-06-26 09:20:50 +00:00
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
|
|
RUN corepack enable
|
2024-07-05 20:04:30 +00:00
|
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
2024-07-05 19:47:22 +00:00
|
|
|
RUN chmod +x /docker-entrypoint.sh
|
2024-06-18 21:44:01 +00:00
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
2024-07-05 19:53:27 +00:00
|
|
|
CMD ["pnpm start:standalone"]
|