k-l-lambda Claude commited on
Commit
2fb00d9
·
1 Parent(s): adc9eb5

Fix: exclude large ONNX files from vite build step

Browse files

ONNX files are copied directly to dist after build.

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. Dockerfile +9 -16
Dockerfile CHANGED
@@ -3,7 +3,7 @@ FROM node:20-slim
3
  # Set noninteractive installation
4
  ENV DEBIAN_FRONTEND=noninteractive
5
 
6
- # Build timestamp to force cache invalidation: 2026-01-12T19:15
7
 
8
  # Install build dependencies
9
  RUN apt-get update && apt-get install -y \
@@ -14,8 +14,10 @@ RUN apt-get update && apt-get install -y \
14
  # Create app directory
15
  WORKDIR /app
16
 
17
- # Copy entire trigo-web project
18
  COPY trigo-web/ ./
 
 
19
 
20
  # Install build tools globally
21
  RUN npm install -g tsx jison typescript esbuild
@@ -31,24 +33,15 @@ RUN npm install --omit=dev && \
31
  # Skip jison parser build - pre-built tgnParser.cjs is already in public/lib/
32
  # RUN tsx tools/buildJisonParser.ts
33
 
34
- # Build frontend (generates dist folder) - add diagnostics
35
- RUN cd app && \
36
- echo "=== Node version ===" && \
37
- node --version && \
38
- echo "=== NPM version ===" && \
39
- npm --version && \
40
- echo "=== Current directory ===" && \
41
- pwd && \
42
- echo "=== Directory listing ===" && \
43
- ls -la && \
44
- echo "=== node_modules/.bin listing ===" && \
45
- ls -la node_modules/.bin/ && \
46
- echo "=== Starting vite build ===" && \
47
- ./node_modules/.bin/vite build
48
 
49
  # Build backend with esbuild (handles ESM imports without .js extensions)
50
  RUN esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm --outfile=backend/dist/server.js --external:express --external:socket.io --external:cors --external:dotenv --external:uuid
51
 
 
 
 
52
  # Set environment variables for Hugging Face Spaces
53
  ENV PORT=7860
54
  ENV HOST=0.0.0.0
 
3
  # Set noninteractive installation
4
  ENV DEBIAN_FRONTEND=noninteractive
5
 
6
+ # Build timestamp to force cache invalidation: 2026-01-12T19:20
7
 
8
  # Install build dependencies
9
  RUN apt-get update && apt-get install -y \
 
14
  # Create app directory
15
  WORKDIR /app
16
 
17
+ # Copy trigo-web project EXCEPT onnx files (too large for build)
18
  COPY trigo-web/ ./
19
+ # Remove large ONNX files before build (will copy back after)
20
+ RUN rm -rf public/onnx
21
 
22
  # Install build tools globally
23
  RUN npm install -g tsx jison typescript esbuild
 
33
  # Skip jison parser build - pre-built tgnParser.cjs is already in public/lib/
34
  # RUN tsx tools/buildJisonParser.ts
35
 
36
+ # Build frontend (generates dist folder)
37
+ RUN cd app && ./node_modules/.bin/vite build
 
 
 
 
 
 
 
 
 
 
 
 
38
 
39
  # Build backend with esbuild (handles ESM imports without .js extensions)
40
  RUN esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm --outfile=backend/dist/server.js --external:express --external:socket.io --external:cors --external:dotenv --external:uuid
41
 
42
+ # Copy ONNX files to dist (they don't need to be processed by vite)
43
+ COPY trigo-web/public/onnx/ ./app/dist/onnx/
44
+
45
  # Set environment variables for Hugging Face Spaces
46
  ENV PORT=7860
47
  ENV HOST=0.0.0.0