nextload/Dockerfile
tobias b448fcc8bb
Some checks failed
continuous-integration/drone/push Build is failing
fix: Typo
2024-06-23 10:42:27 +02:00

47 lines
997 B
Docker

# Build stage
FROM node:20-slim as base
WORKDIR /base
# Local Development
FROM base AS dev
ENTRYPOINT []
CMD ["pnpm", "dev:next"]
# Production
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
EXPOSE 3000
COPY docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["pnpm", "start:standalone"]