henztech commited on
Commit
2947db0
·
verified ·
1 Parent(s): 80a16f8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -16
Dockerfile CHANGED
@@ -1,31 +1,29 @@
1
- # Stage 1: Builder - Clone repo and install dependencies
2
- FROM node:18-alpine AS builder
3
 
4
- # Install git (required for cloning)
5
  RUN apk add --no-cache git
6
 
7
- # Clone your repository
8
  RUN git clone https://github.com/EMMYHENZ-TECH/flasher /app
9
 
 
10
  WORKDIR /app
11
 
 
 
 
 
 
12
  # Install dependencies
13
  RUN npm install
14
 
15
- # Stage 2: Production image
16
- FROM node:18-alpine
17
-
18
- WORKDIR /app
19
-
20
- # Copy from builder
21
- COPY --from=builder /app .
22
 
23
- # Environment variables (set these in Hugging Face)
24
- ENV PORT=3000
25
  ENV NODE_ENV=production
26
 
27
- # Expose port (Hugging Face will map this)
28
- EXPOSE 3000
29
 
30
- # Start your application
31
  CMD ["node", "server.js"]
 
1
+ FROM node:18-alpine
 
2
 
3
+ # Install git
4
  RUN apk add --no-cache git
5
 
6
+ # Clone repo
7
  RUN git clone https://github.com/EMMYHENZ-TECH/flasher /app
8
 
9
+ # Set working directory
10
  WORKDIR /app
11
 
12
+ # Create data directory with correct permissions
13
+ RUN mkdir -p /app/data && \
14
+ chown -R node:node /app/data && \
15
+ chmod -R 755 /app/data
16
+
17
  # Install dependencies
18
  RUN npm install
19
 
20
+ # Switch to non-root user (important for security)
21
+ USER node
 
 
 
 
 
22
 
23
+ # Environment variables
24
+ ENV PORT=7860
25
  ENV NODE_ENV=production
26
 
27
+ EXPOSE 7860
 
28
 
 
29
  CMD ["node", "server.js"]