henztech commited on
Commit
1349090
·
verified ·
1 Parent(s): 683665a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -9
Dockerfile CHANGED
@@ -1,17 +1,29 @@
1
- # Use a lightweight Node.js image
2
- FROM node:18-bullseye
 
 
 
 
 
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- RUN git clone https://github.com/yummi184/Coinbase-Clone.git /app
 
 
 
8
 
9
- # Set correct permissions
10
- RUN chmod -R 777 /app
11
-
12
- # Install project dependencies
13
- WORKDIR /app
14
  RUN npm install
15
 
16
- # Expose a port
 
 
 
 
 
 
17
  EXPOSE 7860
 
 
 
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/yummi184/Coinbase-Clone /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"]