FECUOY commited on
Commit
64e95c3
·
1 Parent(s): 23bde28

Fix Dockerfile for Hugging Face build

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -12
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM node:22-slim
2
 
3
- # Install system dependencies for sandbox and database
4
  RUN apt-get update && apt-get install -y \
5
  python3 \
6
  python3-pip \
@@ -8,29 +8,32 @@ RUN apt-get update && apt-get install -y \
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Install Python dependencies
12
  RUN pip3 install chromadb --break-system-packages
13
 
14
  WORKDIR /app
15
 
16
- # Copy package files
 
 
 
17
  COPY package.json pnpm-lock.yaml ./
18
 
19
- # Install pnpm and dependencies
20
- RUN npm install -g pnpm && pnpm install
21
 
22
  # Copy all project files
23
  COPY . .
24
 
25
- # Build the frontend
 
 
 
 
26
  RUN pnpm build
27
 
28
- # Expose the port (Hugging Face Spaces default is 7860)
29
  EXPOSE 7860
30
 
31
- # Set environment variables
32
- ENV PORT=7860
33
- ENV NODE_ENV=production
34
-
35
- # Start the application
36
  CMD ["pnpm", "start"]
 
1
  FROM node:22-slim
2
 
3
+ # Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  python3 \
6
  python3-pip \
 
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Install Python dependencies (Chromadb needs some build tools sometimes)
12
  RUN pip3 install chromadb --break-system-packages
13
 
14
  WORKDIR /app
15
 
16
+ # Install pnpm
17
+ RUN npm install -g pnpm
18
+
19
+ # Copy package files first for better caching
20
  COPY package.json pnpm-lock.yaml ./
21
 
22
+ # Install dependencies
23
+ RUN pnpm install
24
 
25
  # Copy all project files
26
  COPY . .
27
 
28
+ # Set environment variables for build
29
+ ENV NODE_ENV=production
30
+ ENV PORT=7860
31
+
32
+ # Build the frontend and backend
33
  RUN pnpm build
34
 
35
+ # Ensure the application starts correctly
36
  EXPOSE 7860
37
 
38
+ # Command to run the app
 
 
 
 
39
  CMD ["pnpm", "start"]