Upload pipeline now extracts poster frame (JPEG) and metadata (width, height, duration) from videos at upload time using ffmpeg. Server: - Add ffmpeg to Docker image (Alpine) - video-utils.js: probeVideo() and extractPoster() using ffprobe/ffmpeg - Upload response includes poster_asset_key and duration Frontend: - VideoObject gains poster and duration fields in scene format - VideoSprite accepts posterAssetKey + TextureManager, loads poster as a regular image texture on construction (no <video> needed) - Server poster loaded/released via TextureManager ref counting - addVideoFromUpload passes poster and duration through to scene data - image-drop.ts forwards poster_asset_key from upload response Result: videos with server posters render as images by default. Zero <video> elements needed for thumbnails. Only explicit play creates a media element.
37 lines
844 B
Docker
37 lines
844 B
Docker
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /build
|
|
COPY frontend/package.json ./frontend/
|
|
RUN cd frontend && npm install
|
|
COPY frontend/ ./frontend/
|
|
RUN cd frontend && npm run build
|
|
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
|
|
# Build tools for native modules (better-sqlite3, sharp)
|
|
RUN apk add --no-cache python3 make g++
|
|
|
|
# Backend dependencies
|
|
COPY backend/package.json ./backend/
|
|
RUN cd backend && npm install --production
|
|
|
|
# Remove build tools to keep image smaller
|
|
RUN apk del python3 make g++
|
|
|
|
# Backend source
|
|
COPY backend/ ./backend/
|
|
|
|
# Frontend build output
|
|
COPY --from=frontend-build /build/frontend/dist ./frontend/dist
|
|
|
|
# Data directory for SQLite
|
|
RUN mkdir -p /app/data
|
|
|
|
# ffmpeg for video poster/metadata extraction at upload time
|
|
# Health check utility
|
|
RUN apk add --no-cache wget ffmpeg
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["node", "backend/server.js"]
|