k-l-lambda Claude commited on
Commit
8c8e029
·
1 Parent(s): 11efae4

fix(docker): use git clone to properly resolve LFS files

Browse files

Docker COPY doesn't resolve Git LFS pointers during build. Instead,
clone the repo at build time (with git lfs pull) to get actual files.
This ensures ONNX model files are properly available in the container.

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

Files changed (1) hide show
  1. Dockerfile +16 -23
Dockerfile CHANGED
@@ -2,35 +2,28 @@ FROM node:20-slim
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Build timestamp: 2026-01-17T16:00
6
 
7
  WORKDIR /app
8
 
9
  # Install git and git-lfs for handling large files
10
- RUN apt-get update && apt-get install -y git git-lfs && git lfs install && rm -rf /var/lib/apt/lists/*
11
-
12
- # Copy backend package.json and install ALL deps (including dev for tsx)
13
- COPY trigo-web/backend/package.json ./package.json
 
 
 
 
 
 
 
 
 
 
 
14
  RUN npm install
15
 
16
- # Copy backend source
17
- COPY trigo-web/backend/src/ ./backend/src/
18
-
19
- # Copy inc folder
20
- COPY trigo-web/inc/ ./inc/
21
-
22
- # Copy frontend dist
23
- COPY trigo-web/app/dist/ ./app/dist/
24
-
25
- # Fetch LFS files (in case COPY only got pointers)
26
- COPY .git/ ./.git/
27
- COPY .gitattributes ./
28
- RUN git lfs pull || true
29
- RUN rm -rf .git .gitattributes
30
-
31
- # Copy env files (only .env, .env.local is for local development only)
32
- COPY trigo-web/backend/.env ./backend/.env
33
-
34
  # Create a Docker-specific entry point that sets correct paths
35
  RUN echo 'import express from "express"; \
36
  import { createServer } from "http"; \
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Build timestamp: 2026-01-17T16:30
6
 
7
  WORKDIR /app
8
 
9
  # Install git and git-lfs for handling large files
10
+ RUN apt-get update && apt-get install -y git git-lfs ca-certificates && git lfs install && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Clone the repository with LFS files - this properly resolves LFS pointers
13
+ ARG REPO_URL=https://huggingface.co/spaces/k-l-lambda/trigo
14
+ RUN git clone --depth 1 ${REPO_URL} /tmp/repo && \
15
+ cd /tmp/repo && \
16
+ git lfs pull && \
17
+ cp -r trigo-web/backend/src/ /app/backend/src/ && \
18
+ cp -r trigo-web/inc/ /app/inc/ && \
19
+ cp -r trigo-web/app/dist/ /app/app/dist/ && \
20
+ cp trigo-web/backend/package.json /app/package.json && \
21
+ cp trigo-web/backend/.env /app/backend/.env && \
22
+ rm -rf /tmp/repo
23
+
24
+ # Install ALL deps (including dev for tsx)
25
  RUN npm install
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  # Create a Docker-specific entry point that sets correct paths
28
  RUN echo 'import express from "express"; \
29
  import { createServer } from "http"; \