fp/packages/next/Dockerfile.old

36 lines
863 B
Docker

## @greetz https://medium.com/@elifront/best-next-js-docker-compose-hot-reload-production-ready-docker-setup-28a9125ba1dc
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
RUN apt-get update && apt-get install -y -qq dumb-init
COPY . /app
WORKDIR /app
FROM base AS deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
FROM base AS taco
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
FROM deps AS build
ENV NEXT_TELEMETRY_DISABLED 1
RUN pnpm run -r build
FROM deps AS runner
ENV NEXT_TELEMETRY_DISABLED 1
WORKDIR /app
COPY --from=build /usr/src/app/public ./public
COPY --from=build /usr/src/app/.next/standalone ./
COPY --from=build /usr/src/app/.next/static ./.next/static
EXPOSE 3000
ENV HOSTNAME="0.0.0.0"
CMD [ "dumb-init", "node", "server.js" ]