nextload/Dockerfile
tobias 177050fb28
Some checks failed
continuous-integration/drone Build is failing
'Refine' dockerfile
2024-06-06 08:05:16 +02:00

39 lines
890 B
Docker

FROM node:lts as base
# Set environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /base
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
# Build stage: build the Next.js application
FROM base as build
ENV NODE_ENV=production
WORKDIR /base
RUN pnpm build
# Production stage: serve the application
FROM node:lts as prod
ENV NODE_ENV=production
WORKDIR /app
# Copy package files and install production dependencies
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --production
# Copy build artifacts from the build stage
COPY --from=build /base/.next ./.next
COPY --from=build /base/public ./public
COPY --from=build /base/next.config.js ./
EXPOSE 3000
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["pnpm", "start"]