srinetwork commited on
Commit
a39f69d
·
verified ·
1 Parent(s): 5baae91

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -3
Dockerfile CHANGED
@@ -1,11 +1,33 @@
 
 
1
  FROM node:18-slim
2
 
 
 
 
 
3
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
4
 
5
- RUN mkdir -p /tmp/uploads && chmod 777 /tmp/uploads
 
 
6
 
7
- WORKDIR /app
 
 
8
 
 
 
 
 
 
 
 
9
  EXPOSE 7860
10
 
11
- CMD ["sh", "-c", "git clone https://$GIT_USER:$GITHUB_TOKEN@github.com/$GIT_USER/$GIT_REPO.git . && npm install && node server.js"]
 
 
 
 
 
 
1
+ # SRI API - Hugging Face Spaces Optimized Dockerfile
2
+ # Based on Node.js 18 slim image
3
  FROM node:18-slim
4
 
5
+ # Set working directory
6
+ WORKDIR /app
7
+
8
+ # Install Git (required for cloning private repo)
9
  RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
10
 
11
+ # Accept GitHub token as build argument
12
+ ARG GITHUB_TOKEN
13
+ ENV GITHUB_TOKEN=${GITHUB_TOKEN}
14
 
15
+ # Clone the private repository
16
+ # Using token in URL format for private repo access
17
+ RUN git clone https://${GITHUB_TOKEN}@github.com/Walukapah/SRIAPI26.git .
18
 
19
+ # Install dependencies
20
+ RUN npm install
21
+
22
+ # Create public directory if not exists
23
+ RUN mkdir -p public
24
+
25
+ # Expose port 7860 (Hugging Face Spaces default)
26
  EXPOSE 7860
27
 
28
+ # Set environment variables for Hugging Face
29
+ ENV PORT=7860
30
+ ENV NODE_ENV=production
31
+
32
+ # Start the application
33
+ CMD ["node", "server.js"]