Spaces:
Sleeping

File size: 1,107 Bytes
f24fa17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Simple production Dockerfile for Hugging Face Spaces
FROM node:20-alpine

# Install basic dependencies (including git for HF Spaces)
RUN apk add --no-cache curl wget git dumb-init

# Create app directory
WORKDIR /app

# Copy package files
COPY package*.json ./
COPY backend/package*.json ./backend/
COPY frontend/package*.json ./frontend/

# Install backend dependencies
WORKDIR /app/backend
RUN npm ci --only=production --silent

# Install frontend dependencies and build
WORKDIR /app/frontend
RUN npm ci --silent
COPY frontend/ ./
RUN DISABLE_ESLINT_PLUGIN=true GENERATE_SOURCEMAP=false TSC_COMPILE_ON_ERROR=true npm run build

# Setup production files
WORKDIR /app
COPY backend/ ./backend/
COPY --from=0 /app/frontend/build ./backend/public/

# Set environment
ENV NODE_ENV=production \
    PORT=7860 \
    USE_LOCAL_AI=true \
    USE_HUGGINGFACE=false \
    USE_OPENAI=false

# Expose port
EXPOSE 7860

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:7860/health || exit 1

# Start application
CMD ["node", "backend/server.js"]