# syntax=docker/dockerfile:1 # Base image for edr-freight-api — Node + Alpine Chromium/Puppeteer + pnpm. # Built and pushed separately so app builds pull it from Harbor instead of # reinstalling the ~system Chromium toolchain on every build. # # Build + push (from monorepo root): # docker build -f apps/edr-freight-api/Dockerfile.base \ # -t registry.license.aafda.gov.et/edr/freight-api-base:node24-alpine . # docker push registry.license.aafda.gov.et/edr/freight-api-base:node24-alpine # # Bump the tag whenever Node, Chromium, or the apk set below changes, then # update BASE_IMAGE in Dockerfile to match. FROM node:24.15.0-alpine # Puppeteer ships a glibc Chrome that cannot run on Alpine; skip the ~150MB # download at install time. This stage installs Alpine's system Chromium. ENV PUPPETEER_SKIP_DOWNLOAD=true # Chromium + fonts for Puppeteer PDF rendering (contract/invoice/receipt docs). # Without these, Puppeteer fails to launch and the code degrades to an # unformatted plain-text PDF fallback. Use Alpine's system Chromium (musl-built); # the glibc Chrome that `puppeteer install` downloads cannot run on Alpine. RUN apk add --no-cache \ libc6-compat \ chromium \ nss \ freetype \ harfbuzz \ ca-certificates \ ttf-freefont \ font-noto-cjk ENV NODE_ENV=production # Point Puppeteer at the system Chromium and skip its bundled download. ENV PUPPETEER_SKIP_DOWNLOAD=true ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser # Store pnpm's content-addressable store under PNPM_HOME so the BuildKit # `--mount=type=cache,target=/pnpm/store` cache actually persists deps across builds. ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable WORKDIR /app