Spaces:
Sleeping
Sleeping
Commit ·
90ad400
1
Parent(s): 4f0cc53
Revert to building in Docker instead of using pre-built files
Browse filesThis avoids LFS issues by only copying source files.
ONNX files will need to be handled separately.
Co-Authored-By: Claude <noreply@anthropic.com>
2 unmodified lines34567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556572 unmodified lines# Set noninteractive installationENV DEBIAN_FRONTEND=noninteractive# Build timestamp to force cache invalidation: 2026-01-12T21:20# Install build dependencies including git-lfsRUN apt-get update && apt-get install -y \curl \git \git-lfs \&& rm -rf /var/lib/apt/lists/*# Initialize git lfsRUN git lfs install# Create app directoryWORKDIR /app# Clone the repo directly into temp, pull LFS, then move filesRUN git clone https://huggingface.co/spaces/k-l-lambda/trigo /tmp/repo && \cd /tmp/repo && \git lfs pull && \echo "=== Contents of repo ===" && \ls -la && \echo "=== Contents of trigo-web ===" && \ls -la trigo-web/ && \echo "=== Contents of trigo-web/app ===" && \ls -la trigo-web/app/ && \echo "=== Contents of trigo-web/app/dist ===" && \ls -la trigo-web/app/dist/ && \mv trigo-web/* /app/ && \rm -rf /tmp/repo# Install build tools globally (still needed for some scripts)RUN npm install -g tsx jison typescript# Install dependencies# Root: production only (skip onnxruntime-node which requires native compilation)# App & Backend: runtime deps onlyRUN npm install --omit=dev && \cd app && npm install --omit=dev && \cd ../backend && npm install --omit=dev && \cd ..# All build steps are pre-built:# - Frontend: app/dist/ (includes onnx files)# - Backend: backend/dist/backend/src/server.js# - Parser: public/lib/tgnParser.cjs# Verify dist files exist (will fail if LFS files weren't pulled)RUN test -f app/dist/index.html || (echo "ERROR: app/dist/index.html not found" && exit 1)RUN test -f backend/dist/backend/src/server.js || (echo "ERROR: backend/dist/backend/src/server.js not found" && exit 1)# Set environment variables for Hugging Face SpacesENV PORT=78602 unmodified lines3456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354552 unmodified lines# Set noninteractive installationENV DEBIAN_FRONTEND=noninteractive# Build timestamp to force cache invalidation: 2026-01-12T21:35# Install build dependenciesRUN apt-get update && apt-get install -y \curl \git \&& rm -rf /var/lib/apt/lists/*# Create app directoryWORKDIR /app# Copy only the source files (not pre-built dist)COPY trigo-web/package*.json ./COPY trigo-web/app/package*.json ./app/COPY trigo-web/backend/package*.json ./backend/COPY trigo-web/inc/ ./inc/COPY trigo-web/public/ ./public/COPY trigo-web/app/src/ ./app/src/COPY trigo-web/app/index.html ./app/COPY trigo-web/app/vite.config.ts ./app/COPY trigo-web/app/tsconfig*.json ./app/COPY trigo-web/backend/src/ ./backend/src/COPY trigo-web/backend/tsconfig.json ./backend/# Copy .env filesCOPY trigo-web/.env* ./COPY trigo-web/app/.env* ./app/COPY trigo-web/backend/.env* ./backend/# Install build tools globallyRUN npm install -g tsx jison typescript esbuild# Install dependenciesRUN npm install --omit=dev && \cd app && npm install && \cd ../backend && npm install && \cd ..# Build frontend with viteRUN cd app && npm run build:prod# Build backend with esbuildRUN mkdir -p backend/dist/backend/src && \esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm --outfile=backend/dist/backend/src/server.js --external:express --external:socket.io --external:cors --external:dotenv --external:uuid# Copy the pre-built parserCOPY trigo-web/public/lib/tgnParser.cjs ./public/lib/# Set environment variables for Hugging Face SpacesENV PORT=7860
Dockerfile+32-34