FROM node:24-alpine AS builder WORKDIR /app # Install Chromium and dependencies for Playwright in a single layer RUN apk add --no-cache \ chromium \ nss \ freetype \ freetype-dev \ harfbuzz \ ca-certificates \ ttf-freefont \ curl \ && rm -rf /var/cache/apk/* # Tell Playwright to use the installed Chromium ENV PLAYWRIGHT_BROWSERS_PATH=/usr/bin ENV PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium-browser # Install pnpm RUN npm i -g pnpm # Copy package files COPY package.json pnpm-lock.yaml ./ # Install all dependencies (including dev dependencies for build) RUN pnpm install --frozen-lockfile # Copy source code COPY . . # Build the application RUN pnpm run build # Install only production dependencies and clean up RUN pnpm install --prod --frozen-lockfile \ && pnpm store prune \ && npm cache clean --force # Set environment variables ENV HOST=0.0.0.0 \ PORT=4321 \ NODE_ENV=production # Expose port EXPOSE 4321 # Start the application CMD ["node", "./dist/server/entry.mjs"]