b25a83b164
All checks were successful
continuous-integration/drone/push Build is passing
This reverts commit 83ea63dde4
.
50 lines
1.1 KiB
Docker
50 lines
1.1 KiB
Docker
# Build stage
|
|
FROM node:20-slim as base
|
|
|
|
WORKDIR /base
|
|
|
|
|
|
# Local Development
|
|
FROM base AS dev
|
|
ENTRYPOINT []
|
|
CMD ["pnpm", "dev:next"]
|
|
|
|
|
|
# Production: build
|
|
FROM base AS builder
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
COPY . .
|
|
ENV NODE_ENV=production
|
|
RUN pnpm generate:types
|
|
RUN pnpm build
|
|
|
|
# Production: copy build artifacts
|
|
FROM node:20-slim as runner
|
|
WORKDIR /prod
|
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
|
|
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 ./
|
|
|
|
# Production: serve the website
|
|
FROM runner as prod
|
|
ENV PNPM_HOME="/pnpm"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
CMD ["pnpm start:standalone"]
|