FROM node:alpine AS build WORKDIR /app # Installiere pnpm global RUN npm install -g pnpm # Kopiere den gesamten Quellcode COPY app ./ # Installiere Dependencies mit pnpm RUN pnpm install # Build die Anwendung RUN pnpm run build # Stage 2: Production FROM node:alpine AS production WORKDIR /app # Installiere pnpm global RUN npm install -g pnpm # Kopiere package.json für Production Dependencies COPY --from=build /src/package*.json ./ COPY --from=build /src/pnpm-lock.yaml ./ # Installiere nur Production Dependencies ohne Scripts RUN pnpm install --prod --frozen-lockfile --ignore-scripts # Kopiere Build-Artefakte und benötigte Konfigurationsdateien COPY --from=build /src/.next .next COPY --from=build /src/next.config.mjs ./ COPY --from=build /src/source.config.ts ./ COPY --from=build /src/.source .source COPY --from=build /src/tsconfig.json ./ EXPOSE 3000 ENV NODE_ENV=production CMD ["pnpm", "start"]