File size: 2,110 Bytes
ef4c36f
 
18d2e31
492a1b0
ef4c36f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
caf223c
492a1b0
caf223c
ef4c36f
c25010e
ef4c36f
 
 
 
c25010e
ef4c36f
 
 
06a35b8
ef4c36f
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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}"]