# syntax=docker/dockerfile:1 # MedASR Bench — Hugging Face Docker Space (CPU). Next.js 16 standalone output. # The Space runtime requires the container to run as uid 1000 and listen on # app_port (3000, set in README.md front-matter). # ---- deps: install full deps for the build ---- FROM node:22-alpine AS deps RUN apk add --no-cache libc6-compat WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci # ---- builder: produce .next/standalone ---- FROM node:22-alpine AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . ENV NEXT_TELEMETRY_DISABLED=1 RUN npm run build # ---- runner: minimal self-contained image ---- FROM node:22-alpine AS runner WORKDIR /app ENV NODE_ENV=production \ NEXT_TELEMETRY_DISABLED=1 \ PORT=3000 \ HOSTNAME=0.0.0.0 # node:alpine already ships a `node` user at uid 1000 — exactly what HF Spaces # expect — so no custom user is created (uid 1000 is already taken). # server.js lives at the root of .next/standalone; public/ and .next/static # are NOT bundled into standalone and must be copied in explicitly. COPY --from=builder --chown=node:node /app/.next/standalone ./ COPY --from=builder --chown=node:node /app/.next/static ./.next/static COPY --from=builder --chown=node:node /app/public ./public USER node EXPOSE 3000 CMD ["node", "server.js"]