Spaces:
Running
Running
Commit
·
617ede1
1
Parent(s):
b218f18
Clone repo with git-lfs inside Docker to get LFS files
Browse filesDocker COPY doesn't resolve LFS files properly.
Clone the repo and use git lfs pull to get actual files.
Co-Authored-By: Claude <noreply@anthropic.com>
- Dockerfile +22 -11
Dockerfile
CHANGED
|
@@ -2,33 +2,44 @@ FROM node:20-slim
|
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
-
# Build timestamp: 2026-01-13T00:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
# Install esbuild globally
|
| 10 |
RUN npm install -g esbuild
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
RUN npm install --omit=dev
|
| 15 |
|
| 16 |
# Copy backend source and build
|
| 17 |
RUN mkdir -p backend backend/dist/backend/src
|
| 18 |
-
|
| 19 |
RUN esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm \
|
| 20 |
--outfile=backend/dist/backend/src/server.js \
|
| 21 |
--external:express --external:socket.io --external:cors --external:dotenv --external:uuid
|
| 22 |
|
| 23 |
-
# Copy frontend dist
|
| 24 |
-
|
| 25 |
|
| 26 |
# Copy public and other files
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
ENV PORT=7860
|
| 34 |
ENV HOST=0.0.0.0
|
|
|
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
+
# Build timestamp: 2026-01-13T00:40
|
| 6 |
+
|
| 7 |
+
# Install git and git-lfs
|
| 8 |
+
RUN apt-get update && apt-get install -y git git-lfs && rm -rf /var/lib/apt/lists/*
|
| 9 |
+
RUN git lfs install
|
| 10 |
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
# Install esbuild globally
|
| 14 |
RUN npm install -g esbuild
|
| 15 |
|
| 16 |
+
# Clone the repo to get LFS files properly
|
| 17 |
+
RUN git clone --depth 1 https://huggingface.co/spaces/k-l-lambda/trigo /tmp/repo && \
|
| 18 |
+
cd /tmp/repo && git lfs pull
|
| 19 |
+
|
| 20 |
+
# Copy files from cloned repo
|
| 21 |
+
RUN cp /tmp/repo/trigo-web/backend/package.json ./package.json
|
| 22 |
RUN npm install --omit=dev
|
| 23 |
|
| 24 |
# Copy backend source and build
|
| 25 |
RUN mkdir -p backend backend/dist/backend/src
|
| 26 |
+
RUN cp -r /tmp/repo/trigo-web/backend/src ./backend/
|
| 27 |
RUN esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm \
|
| 28 |
--outfile=backend/dist/backend/src/server.js \
|
| 29 |
--external:express --external:socket.io --external:cors --external:dotenv --external:uuid
|
| 30 |
|
| 31 |
+
# Copy frontend dist (with LFS files properly resolved)
|
| 32 |
+
RUN cp -r /tmp/repo/trigo-web/app/dist ./app/
|
| 33 |
|
| 34 |
# Copy public and other files
|
| 35 |
+
RUN cp -r /tmp/repo/trigo-web/public ./
|
| 36 |
+
RUN cp /tmp/repo/trigo-web/.env ./.env || true
|
| 37 |
+
RUN mkdir -p backend && cp /tmp/repo/trigo-web/backend/.env ./backend/.env || true
|
| 38 |
+
RUN cp /tmp/repo/trigo-web/backend/.env.local ./backend/.env.local || true
|
| 39 |
+
RUN cp -r /tmp/repo/trigo-web/inc ./
|
| 40 |
+
|
| 41 |
+
# Cleanup
|
| 42 |
+
RUN rm -rf /tmp/repo
|
| 43 |
|
| 44 |
ENV PORT=7860
|
| 45 |
ENV HOST=0.0.0.0
|