henztech commited on
Commit
3e71ab7
·
verified ·
1 Parent(s): 54ec8d1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -1,27 +1,29 @@
1
- # Use official Node.js image
2
  FROM node:18-alpine
3
 
4
- # Install git (required for cloning)
5
  RUN apk add --no-cache git
6
 
7
- # Clone your GitHub repo
8
  RUN git clone https://github.com/EMMYHENZ-TECH/grand-Bnk-2 /app
9
 
10
  # Set working directory
11
  WORKDIR /app
12
 
 
 
 
 
 
13
  # Install dependencies
14
  RUN npm install
15
 
16
- # Create data directory (for JSON files)
17
- RUN mkdir -p /app/data
18
 
19
- # Set environment variables
20
  ENV PORT=7860
21
  ENV NODE_ENV=production
22
 
23
- # Expose the port
24
  EXPOSE 7860
25
 
26
- # Start the Node.js app
27
  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/grand-Bnk-2 /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"]