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>
- Dockerfile +32 -34
Dockerfile
CHANGED
|
@@ -3,55 +3,53 @@ FROM node:20-slim
|
|
| 3 |
# Set noninteractive installation
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
|
| 6 |
-
# Build timestamp to force cache invalidation: 2026-01-12T21:
|
| 7 |
|
| 8 |
-
# Install build dependencies
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
curl \
|
| 11 |
git \
|
| 12 |
-
git-lfs \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
| 15 |
-
# Initialize git lfs
|
| 16 |
-
RUN git lfs install
|
| 17 |
-
|
| 18 |
# Create app directory
|
| 19 |
WORKDIR /app
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
# Install dependencies
|
| 40 |
-
# Root: production only (skip onnxruntime-node which requires native compilation)
|
| 41 |
-
# App & Backend: runtime deps only
|
| 42 |
RUN npm install --omit=dev && \
|
| 43 |
-
cd app && npm install
|
| 44 |
-
cd ../backend && npm install
|
| 45 |
cd ..
|
| 46 |
|
| 47 |
-
#
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
#
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
#
|
| 53 |
-
|
| 54 |
-
RUN test -f backend/dist/backend/src/server.js || (echo "ERROR: backend/dist/backend/src/server.js not found" && exit 1)
|
| 55 |
|
| 56 |
# Set environment variables for Hugging Face Spaces
|
| 57 |
ENV PORT=7860
|
|
|
|
| 3 |
# Set noninteractive installation
|
| 4 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 5 |
|
| 6 |
+
# Build timestamp to force cache invalidation: 2026-01-12T21:35
|
| 7 |
|
| 8 |
+
# Install build dependencies
|
| 9 |
RUN apt-get update && apt-get install -y \
|
| 10 |
curl \
|
| 11 |
git \
|
|
|
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
|
|
|
|
|
|
|
|
|
| 14 |
# Create app directory
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
+
# Copy only the source files (not pre-built dist)
|
| 18 |
+
COPY trigo-web/package*.json ./
|
| 19 |
+
COPY trigo-web/app/package*.json ./app/
|
| 20 |
+
COPY trigo-web/backend/package*.json ./backend/
|
| 21 |
+
COPY trigo-web/inc/ ./inc/
|
| 22 |
+
COPY trigo-web/public/ ./public/
|
| 23 |
+
COPY trigo-web/app/src/ ./app/src/
|
| 24 |
+
COPY trigo-web/app/index.html ./app/
|
| 25 |
+
COPY trigo-web/app/vite.config.ts ./app/
|
| 26 |
+
COPY trigo-web/app/tsconfig*.json ./app/
|
| 27 |
+
COPY trigo-web/backend/src/ ./backend/src/
|
| 28 |
+
COPY trigo-web/backend/tsconfig.json ./backend/
|
| 29 |
+
|
| 30 |
+
# Copy .env files
|
| 31 |
+
COPY trigo-web/.env* ./
|
| 32 |
+
COPY trigo-web/app/.env* ./app/
|
| 33 |
+
COPY trigo-web/backend/.env* ./backend/
|
| 34 |
+
|
| 35 |
+
# Install build tools globally
|
| 36 |
+
RUN npm install -g tsx jison typescript esbuild
|
| 37 |
|
| 38 |
# Install dependencies
|
|
|
|
|
|
|
| 39 |
RUN npm install --omit=dev && \
|
| 40 |
+
cd app && npm install && \
|
| 41 |
+
cd ../backend && npm install && \
|
| 42 |
cd ..
|
| 43 |
|
| 44 |
+
# Build frontend with vite
|
| 45 |
+
RUN cd app && npm run build:prod
|
| 46 |
+
|
| 47 |
+
# Build backend with esbuild
|
| 48 |
+
RUN mkdir -p backend/dist/backend/src && \
|
| 49 |
+
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
|
| 50 |
|
| 51 |
+
# Copy the pre-built parser
|
| 52 |
+
COPY trigo-web/public/lib/tgnParser.cjs ./public/lib/
|
|
|
|
| 53 |
|
| 54 |
# Set environment variables for Hugging Face Spaces
|
| 55 |
ENV PORT=7860
|