# ponytail: Playwright's own image already ships chromium + all its system libs FROM mcr.microsoft.com/playwright:v1.61.1-noble WORKDIR /app # ponytail: dev deps stay installed so `next build` works; compose flips this to development ENV NEXT_TELEMETRY_DISABLED=1 RUN corepack enable # ponytail: node-canvas/FreeType can't read @fontsource's .woff — captions render as tofu # boxes without real TTFs. Install them system-wide so fontconfig resolves them by family. RUN mkdir -p /usr/share/fonts/truetype/reel \ && curl -fsSL -o /usr/share/fonts/truetype/reel/Anton-Regular.ttf \ https://github.com/google/fonts/raw/main/ofl/anton/Anton-Regular.ttf \ && curl -fsSL -o /usr/share/fonts/truetype/reel/Oswald.ttf \ "https://github.com/google/fonts/raw/main/ofl/oswald/Oswald%5Bwght%5D.ttf" \ && fc-cache -f COPY package.json pnpm-lock.yaml ./ # ponytail: lockfile is already vetted on the host; skip pnpm's release-age gate RUN pnpm install --frozen-lockfile --config.minimumReleaseAge=0 \ --config.dangerouslyAllowAllBuilds=true # ponytail: HF Spaces run the container as UID 1000, which cannot read /root/.cache — # install browsers to the image-wide path instead and make them world-readable ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright # ponytail: image ships 1.61.1's browsers; our playwright is newer, so fetch its build RUN ./node_modules/.bin/playwright install chromium \ && chmod -R a+rX /ms-playwright COPY . . RUN ./node_modules/.bin/next build # ponytail: HF Spaces run as UID 1000 — storage/ and .next must be writable by it RUN mkdir -p /app/storage \ && chown -R 1000:1000 /app \ && chmod -R u+rwX /app/storage # ponytail: free hosts dictate the port (HF Spaces app_port, Cloud Run 8080) — honour $PORT ENV PORT=3000 EXPOSE 3000 # HF Spaces expect the app to run as this user; harmless locally USER 1000 # ponytail: run next directly — `pnpm start` re-runs its deps/policy check at boot. # compose overrides this with `next dev` for local work. CMD ["sh", "-c", "./node_modules/.bin/next start --hostname 0.0.0.0 --port ${PORT:-3000}"]