# Optimized Dockerfile for Next.js e2e testing # Simplified approach to avoid multi-stage build issues FROM node:20-alpine # Install build dependencies required for SWC and sharp RUN apk add --no-cache \ python3 \ python3-dev \ py3-pip \ py3-setuptools \ make \ g++ \ git \ curl \ && ln -sf python3 /usr/bin/python # Install sharp dependencies (if using image optimization) RUN apk add --no-cache vips-dev WORKDIR /app # Copy package files COPY package.json package-lock.json* ./ COPY apps/website/package.json apps/website/package-lock.json* ./apps/website/ # Install dependencies ENV NPM_CONFIG_FUND=false \ NPM_CONFIG_AUDIT=false \ NPM_CONFIG_UPDATE_NOTIFIER=false \ NPM_CONFIG_PREFER_OFFLINE=true # Install dependencies (use install instead of ci to handle missing sharp) RUN npm install --include-workspace-root --no-audit --fund=false # Copy source code COPY . . # Build the website WORKDIR /app/apps/website RUN npm run build # Expose port EXPOSE 3000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD curl -f http://localhost:3000/ || exit 1 # Start command (production mode) CMD ["npm", "start"]